Difference in DUContext::findDeclarations() when using QualifiedIdentfier instead of Identifier
Milian Wolff
mail at milianw.de
Sat Sep 26 13:20:47 UTC 2009
Am Samstag, 26. September 2009 15:12:58 schrieb Milian Wolff:
> Hi there!
>
> I just spotted some unexpected behavior in the DUChain:
>
> I have a function, with some arguments (e.g. arg1, arg2). The
> DUContext::Function type context gets imported in the internalContext() of
> the function declaration.
>
> Now I can do e.g.:
>
> funcDec->internalContext->findDeclarations(Identifier("arg1"))
>
> And that will find me the declaration of arg1. So far so good.
>
> But when I change the above to use QualifiedIdentifier, instead of
> Identifier, it doesn't work anymore.
>
> How come?
>
> Example:
>
> foreach ( Declaration* arg, funcDec->internalFunctionContext()-
>
> >localDeclarations() ) {
>
> QList<Declaration*> decs = funcDec->internalContext()-
>
> >findDeclarations(arg->qualifiedIdentifier());
>
> QCOMPARE(decs.size(), 1);
> }
>
> I'd expect that this works, but it doesn't. the decs list is always empty.
> If I use arg->identifier() it works though...
>
> David, can you explain that?
>
I committed a test case for that.
Compile PHP plugin, go to $BUILDDIR/duchain/tests
run ./duchaintest.shell testFindFunctionArgs
--
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090926/1ce3fd57/attachment.sig>
More information about the KDevelop-devel
mailing list