DUChain questions

David Nolden zwabel at googlemail.com
Thu Sep 4 08:42:06 UTC 2008


Am Donnerstag, 4. September 2008 08:13:39 schrieb Niko Sams:
> Hi,
>
> I have a few issues for the php language support:
>
> 1. two declarations with different types and the same identifier
> within one scope,
> example:
> class A {}
> class B {}
> $foo = new A();
> $foo = new B();
>
> Currently I create a new declaration on every assignment operation. In
> that example
> there are two declarations. But the uses don't work correctly - once I
> add uses to one declaration
> both return them in uses().
> What is the correct way to go here?

Well, the second assignment should be a use of the $foo declaration I think.

About the shared uses:
In general used declarations are adressed by declaration-id. If you want to 
prevent the uses from being shared for multiple variables/classes with the 
same qualified identifier, you have to:
Either don't put the class/variable in the symbol table, then the uses will 
adress the declarations directly.
Or disambiguate the declaration-identities by using 
Declaration::additionalIdentity.
Although I think used declarations are also adressed directly if they are from 
the same file.

> 2. include paths. There is no make-system I could ask about include
> paths, those are either
> server-configuration or set dynamically in the code. So I think we
> need an ui for setting those
> include paths.
> How/Where should this be implemented, or any other ideas?

No Idea atm, but C++ could use a system too to set the include-paths on the 
fly, so if you implement something, would be good if it was reusable in some 
way.

> 3. When a class is used it doesn't necessarily have to be included -
> instead i look it up in
> the CodeModel. (done so far) But this works only if the used class has
> been parsed. Even with whole project
> parsing activated it can happen that the used class is parsed after the
> use. How can I fix this?
Hmm I only see one solution to this: Parse everything twice. After the first 
cycle all classes will be in the symbol-table/code-model, after the second 
pass uses and types will be correct.

Greetings, David




More information about the KDevelop-devel mailing list