add something a la CodeModelItem::visibility ?

David Nolden zwabel at googlemail.com
Sun Sep 20 22:27:44 UTC 2009


Am Montag 21 September 2009 00:07:06 schrieb Milian Wolff:
> In regard to your last email, I can't use this then.
> 
> Could this speedup be "fixed"? I mean this makes it really impossible for
>  me add anything to setInSymbolTable(false) !
When you do "context->setInSymbolTable(false)", you get the same effect as if 
you did in on the declarations individually, and findLocalDeclarations(..) 
will work perfectly. Why is that a problem? It usually depends on the context 
whether something is visible globally or not, not on the item itself.

For example, you can _always_ call "setInSymbolTable(false)" on the internal 
context of a function. At least I've never seen in any language something like 
"someFunction.localVariable = 3".

> And it makes no sense to me that you would only get decs in the symbol
>  table when you explicitly request the child-items of a context.
> 
> In my impression, any findLocalDeclaration or the localDeclarations()
>  method should give me the declarations of the current context, no matter
>  whether they are in the symbol table or not.
Of course. The problem is only if "context->inSymbolTable() != context-
>declarations()[x]->inSymbolTable()".

So in order to make this consistent, maybe the best fix is just removing 
"Declaration::setInSymbolTable", so declarations always inherit the visibility 
of the context.

The other fix would be making sure that the local-search speedup through the 
symbol-table is not used if the context contains at least one declaration that 
has "inSymbolTable() == false", but that's annoying and maybe even slow to do.

Greetings, David




More information about the KDevelop-devel mailing list