Review Request 118451: Build uses for field member expressions
Denis Steckelmacher
steckdenis at yahoo.fr
Sun Jun 1 14:22:20 UTC 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/118451/
-----------------------------------------------------------
(Updated June 1, 2014, 2:22 p.m.)
Status
------
This change has been marked as submitted.
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/e538c979/attachment.html>
More information about the KDevelop-devel
mailing list