ForwardDeclaration usage
Andreas Pakulat
apaku at gmx.de
Wed Feb 11 14:41:10 UTC 2009
On 11.02.09 14:15:24, Milian Wolff wrote:
> I introduced a PreDeclarationBuilder for PHP but this introduced a bunch of
> bugs I only now realize. Before I try to fix them, I wanted to ask if I could
> not make it obsolete by using ForwardDeclarations.
Note: I'm no DUChain expert, however
> Take this code:
>
> ~~~~
> <?php
> $foo = new Bar;
> class Bar {}
> ~~~~
>
> I.e.: In PHP it is possible to use classes before they are actually declared.
Actually Bar is used before its defined.
Anyway, yes I think you could and should use ForwardDeclaration for that,
because thats really what you're telling the PHP interpreter: Create a new
object from the class Bar, which I will define later on. The only catch
might be if one cannot have the same range covering a ForwardDeclaration
and a Use, because the new Bar is also still a Use of the class Bar...
Andreas
--
You'll feel devilish tonight. Toss dynamite caps under a flamenco dancer's
heel.
More information about the KDevelop-devel
mailing list