Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] Search method local elements

Hi Andrey,

Just to make sure, do you think is it correct that all nested
elements, which declared inside of function or method will have an
ISourceModule (the module where defining function belongs) as a
parent? It's ok for PHP, but I don't know whether it's true for all
languages.

Thanks!

On 6/6/08, Andrei Sobolev <andrei.sobolev@xxxxxxxxx> wrote:
> Hi Michael,
>
> Yes, problem you mentioned, are also relevant for other languages, like Tcl, Python.
> I've checked patch, and found that it is not fully functional.
> IMethod handles created for inner functions, has incorrect parent.
>
> To make it work, you need to modify MatchLocator.createHandle(MethodDeclaration method, IModelElement parent) to create correct handles for methods.
>
> Could you please notify us, to update tcl search accordingly(In Tcl we override this function), after you commit the code.
>
> Thanks,
> Andrei.
>
> ----- Original Message -----
> From: "Michael Spector" <spektom@xxxxxxxxx>
> To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
> Sent: Thursday, June 5, 2008 10:10:55 PM GMT +06:00 Almaty, Novosibirsk
> Subject: [Dltk-dev] Search method local elements
>
> Hi All,
>
> Currently DLTK search mechanism doesn't support searching elements
> which are declared inside of method/function.
> This is pretty usual case in PHP, for instance, you can write the following:
>
> <?php
> function foo() {
>   function bar() {
>      print "OK\n";
>   }
> }
>
> bar(); // Fatal Error: Call to undefined function bar()
> foo();
> bar(); // prints OK
>
> ?>
>
> The same regarding classes, which are declared inside of function/method.
>
> Attached is a patch, that allows to continue searching for local declarations.
> Please review it, and say your word about it. If nobody has any
> objections - I'll commit it.
>
> Thanks!
>
> --
> Michael
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>


-- 
Michael


Back to the top