Review Request 117544: Use assignations to variables tu deduce their types

Denis Steckelmacher steckdenis at yahoo.fr
Sun Apr 13 16:07:46 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/117544/
-----------------------------------------------------------

(Updated April 13, 2014, 4:07 p.m.)


Status
------

This change has been marked as submitted.


Review request for KDevelop.


Repository: kdev-qmljs


Description
-------

This patch adds support variables whose types become known only after an assignation, like in "var a; a = 3;". When a variable is assigned multiple values, the types of all the expressions assigned to the variable are merged into an unsure type.

ExpressionVisitor and ContextBuilder::findType are modified in order to return the last declaration corresponding to the type of an expression, if any. For instance, "a" is an expression of type int and its corresponding declaration is the "var a;" of the previous paragraph. This is needed because there is no way to find the declaration that "owns" a type, as it is possible for context.


Diffs
-----

  duchain/contextbuilder.h d53b2fe 
  duchain/contextbuilder.cpp 350ff0c 
  duchain/declarationbuilder.h 532bb56 
  duchain/declarationbuilder.cpp 5594616 
  duchain/expressionvisitor.h da35686 
  duchain/expressionvisitor.cpp 049e68f 
  tests/files/helloworld.js 83c121b 

Diff: https://git.reviewboard.kde.org/r/117544/diff/


Testing
-------

This patch adds one unit test.


Thanks,

Denis Steckelmacher

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140413/d080d1ad/attachment.html>


More information about the KDevelop-devel mailing list