Difference in DUContext::findDeclarations() when using QualifiedIdentfier instead of Identifier

David Nolden zwabel at googlemail.com
Wed Sep 30 07:17:56 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?
Something must be wrong with your qualified identifier, maybe it has the 
'explicitly global' flag set which influences the search?

Greetings, David




More information about the KDevelop-devel mailing list