<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/117509/">https://git.reviewboard.kde.org/r/117509/</a>
     </td>
    </tr>
   </table>
   <br />




<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for KDevelop.</div>
<div>By Denis Steckelmacher.</div>


<p style="color: grey;"><i>Updated April 12, 2014, 11:01 a.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Recognize "1.0" as being a double even if this number has an exact integer representation. This is done by computing the log10 of the number, which gives the number of digits of its integral part. If the token representing this nunmber is longer than that, then it's a double ("1." is already a double, "1.00" is also a double, but "18303" is an integer).</pre>
  </td>
 </tr>
</table>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kdev-qmljs
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This patch is a stripped-down version of review #117458. It changes ExpressionVisitor and ContextBuilder::findType in order to use the same architecture as the one used by Ruby. As Javascript expressions can contain declarations (for instance in "var c = function() { var b = 5; return b; }"), ExpressionVisitor can have problems finding the type of such expressions. By first letting DeclarationBuilder recurse in the expression (and build every declaration it encounters), ExpressionVisitor becomes able to see them and to return their type. ExpressionVisitor is also changed to stop visiting nodes the first time it encounters a type it can deduce, as there is no need to recurse all the way to the bottom of very long JS expressions.

This patch does not add any feature to the JS language support and only changes what is required in order to have ExpressionVisitor leverage DeclarationBuilder to build declarations. This patch also moves code around and improves how double and int numbers are differentiated. I've put these cleanups in this patch because it already rewrites most of ExpressionVisitor, and the next patches are easier to understand if they don't move anything and just add methods.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The QML/JS testsuite passes with this patch, with two tests marked as expected to fail. The reason is that function expressions are not yet recognized by the parser, so "var c = function(a) { return a; }" doesn't have a type yet.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>duchain/CMakeLists.txt <span style="color: grey">(9fab69c)</span></li>

 <li>duchain/contextbuilder.cpp <span style="color: grey">(d38da2d)</span></li>

 <li>duchain/declarationbuilder.h <span style="color: grey">(001c3b2)</span></li>

 <li>duchain/declarationbuilder.cpp <span style="color: grey">(98da341)</span></li>

 <li>duchain/expressionvisitor.h <span style="color: grey">(b4f0851)</span></li>

 <li>duchain/expressionvisitor.cpp <span style="color: grey">(766435d)</span></li>

 <li>duchain/parsesession.h <span style="color: grey">(0eb2762)</span></li>

 <li>duchain/parsesession.cpp <span style="color: grey">(dbc4d90)</span></li>

 <li>duchain/tests/testdeclarations.cpp <span style="color: grey">(668efaa)</span></li>

 <li>tests/files/helloworld.js <span style="color: grey">(ff40f1c)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/117509/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>




  </div>
 </body>
</html>