Review Request 117971: Use QML qualified identifiers to build uses

Sven Brauch svenbrauch at googlemail.com
Sat May 3 11:55:31 UTC 2014



> On May 3, 2014, 11:21 a.m., Sven Brauch wrote:
> > Nice! Add a unit test and then ship it.
> > 
> > You can do that for example like this:
> > 
> >     int useIndex = top->findUseAt(Cursor(3, 5));
> >     QVERIFY(useIndex != -1);
> >     QVERIFY(useIndex < top->usesCount());
> >     const Use* u = &(top->uses()[useIndex]);
> >     Declaration* d = u->usedDeclaration(top->topContext());
> >     // ...
> 
> Sven Brauch wrote:
>     Ah, you use those json tests. Not sure how to do it there. I'll try talking to olijg.

Ok, apparently you can do this:
/// "useCount" : 1
var i = 0
a += i

or so.


- Sven


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


On May 3, 2014, 9:47 a.m., Denis Steckelmacher wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/117971/
> -----------------------------------------------------------
> 
> (Updated May 3, 2014, 9:47 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Repository: kdev-qmljs
> 
> 
> Description
> -------
> 
> The Javascript parser builds IdentifierExpression AST nodes in Javascript files and UiQualifiedId AST nodes in QML files. This patch adds support for the latter ones in UseBuilder. This enables the QML/JS plugin to detect the use of QML components in QML files.
> 
> 
> Diffs
> -----
> 
>   duchain/usebuilder.h 39605ac 
>   duchain/usebuilder.cpp 3e5d0a1 
> 
> Diff: https://git.reviewboard.kde.org/r/117971/diff/
> 
> 
> Testing
> -------
> 
> I don't know how to unit test the use builder, and I would welcome any hint about that :-) . I manually tested that the use of "Foo" in this snippet is correctly detected:
> 
> Component {
>     name: "Foo"
> }
> 
> Foo {}
> 
> When I put my cursor on Foo, "Component" gets highlighted (because the declaration of Foo is located on the Component keyword). If I click on "show uses" in the information popup of "Component", the first line and the line instantiating Foo are listed.
> 
> 
> Thanks,
> 
> Denis Steckelmacher
> 
>

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


More information about the KDevelop-devel mailing list