Class used before declaration

David Nolden zwabel at googlemail.com
Sun Jan 11 11:16:15 UTC 2009


Am Sunday 11 January 2009 04:55:06 schrieb Hamish Rodda:
> On Saturday 10 January 2009 03:02:53 Niko Sams wrote:
> > Hi,
> >
> > I have another problem with Php support, in Php the following is
> > possible: $a = new Foo;
> > class Foo {}
> >
> > But in the TypeBuilder I can't find Foo - as its type and declaration
> > not yet created.
> >
> > A second DeclarationBuilder run would work - but that is not very
> > efficent.
>
> Separate the type builder and the declaration builder, and run them in two
> passes.  That's why we have the separate abstract*builder classes and the
> inheritance and run order is specified by the language support plugin.
>
> Cheers,
> Hamish.

Since the declaration-searching mechanism is used for finding types, the 
solution is probably running the complete declaration-builder 2 times.

The first time could be "shallow", without descending into 
code-contexts(Unless classes can be defined there too)

Greetings, David




More information about the KDevelop-devel mailing list