Class used before declaration

Niko Sams niko.sams at gmail.com
Sat Jan 10 08:45:55 UTC 2009


> How does the real php-interpreter deal with it?
I guess it doesn't evaluate new Foo on parsing  - only when executing.

> The most logical approach
> would probably be multiple passes: One for building types, and one for doing
> the rest.
but doesn't "new Foo;" need the declaration - not just the type?
(At least currently I search using findDeclarations)

> However if you want to cater this special case without having to do that, you
> could think about creating a forward-declaration of "class Foo" on "new Foo;"
> when Foo is not found.
I would have to do that for every unknown class then - and can't
create a problem for an unknown class
as I do now.

Niko




More information about the KDevelop-devel mailing list