Review Request 118451: Build uses for field member expressions

Sven Brauch svenbrauch at googlemail.com
Sun Jun 1 13:59:46 UTC 2014


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

Ship it!


Very nice work, can't see anything wrong with it. Thanks!


duchain/usebuilder.h
<https://git.reviewboard.kde.org/r/118451/#comment40981>

    make this const (if possible?)



duchain/usebuilder.cpp
<https://git.reviewboard.kde.org/r/118451/#comment40982>

    move this below to where it is used


- Sven Brauch


On June 1, 2014, 1:49 p.m., Denis Steckelmacher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/118451/
> -----------------------------------------------------------
> 
> (Updated June 1, 2014, 1:49 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdev-qmljs
> 
> 
> Description
> -------
> 
> This patch adds support for field member expressions ("base.identifier") to ExpressionVisitor and UseBuilder. When ExpressionVisitor encounters such an expression, it finds the type of the base (that can be anything) and then looks in its internal context for the declaration of the identifier. UseBuilder has also been modified to take advantage of this: when a field member expression is encountered, ExpressionVisitor is used to get its corresponding declaration.
> 
> This patch makes something like this possible:
> 
> Item {
>     id: test
>     prop: "value"
> 
>     onSomething: { console.log(test.prop); }
> }
> 
> "prop" in "test.prop" is registered as being an use of the "prop" property of test.
> 
> Currently, only QML components are handled. Snippets like "var a = {foo: "bar"}; a.bar = "bar";" are currently not supported because a is not declared in such a way that ExpressionVisitor can find a declaration having an inner context. I have ideas allowing this to work, though.
> 
> 
> Diffs
> -----
> 
>   duchain/expressionvisitor.h b5c2781 
>   duchain/expressionvisitor.cpp 68a6226 
>   duchain/helper.h fa28a9c 
>   duchain/helper.cpp 480a051 
>   duchain/usebuilder.h 6ffbf62 
>   duchain/usebuilder.cpp 7d443c3 
>   tests/files/test.qml f6b1295 
> 
> Diff: https://git.reviewboard.kde.org/r/118451/diff/
> 
> 
> Testing
> -------
> 
> The testsuite passes, and a new test ensures that "prop" has two uses (its declaration and "test.prop") in the snippet I give in the description.
> 
> 
> Thanks,
> 
> Denis Steckelmacher
> 
>

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


More information about the KDevelop-devel mailing list