On 11/15/2010 08:48 PM, Eric M. Ludlam wrote:
> On 11/13/2010 01:18 PM, Andrey Torba wrote:
>> Test fails with the following errors:
>> ** Starting tests in testclass.py
>> Failed 1. Desired: ("foo1") Actual nil
>> Failed 2. Desired: ("foo1" "foo2") Actual nil
>> Unit tests (completions) failed tests (1 2)
>> ** Completed tests in testclass.py
>> Why can't semantic find functions for the contexts 1 and 2?
> If you do:
> M-x semantic-analyze-current-context RET
> you will note that there are no local variables defined. Python needs
> an implementation of semantic-get-local-variables. By default it will
> attempt to call the parser with the special goal symbol
> bovine-inner-scope, or you can write your own similar to the one in
> Basically, the parser needs to be updated so that if it sees:
> cl = Class1();
> it creates a variable "cl" of type "Class1". Once that works, then the
> analyzer will be able to start making more detailed suggestions.
I've been looking into the python parser to see how to make it get type
information, but I don't know much about python. Hopefully who knows
python can help.
It seems variables are not declared, but just created along the way, so
to determine if something is a variable and what its type is, you need
to scan backward from the current location for the most recent
assignment? The parser already has rules for finding variables, but it
can't divine the type of the thing in question. Are there any simple
rules in python that make the type of a variable deterministic, or is it
mostly guess work?