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 Michael,
> 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.
>   
For other languages this is not correct.
For Ruby, Tcl, Python such functions will be not visible outside of
parent function.
I suppose we need to have this behavior by default.
And allow each language developer to override this if required, as in PHP.

Best regards,
Andrei Sobolev.
> 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
>>
>>     
>
>
>   



Back to the top