forked from VimPlug/jedi
properties now also working as assignments, not only as decorators. debug output still visible.
This commit is contained in:
40
evaluate.py
40
evaluate.py
@@ -236,6 +236,10 @@ class InstanceElement(object):
|
|||||||
par = InstanceElement(self.instance, par)
|
par = InstanceElement(self.instance, par)
|
||||||
return par
|
return par
|
||||||
|
|
||||||
|
def get_var(self):
|
||||||
|
pass
|
||||||
|
#if self.var
|
||||||
|
|
||||||
def get_parent_until(self, *classes):
|
def get_parent_until(self, *classes):
|
||||||
scope = self.var.get_parent_until(*classes)
|
scope = self.var.get_parent_until(*classes)
|
||||||
return InstanceElement(self.instance, scope)
|
return InstanceElement(self.instance, scope)
|
||||||
@@ -859,12 +863,16 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
|||||||
elif isinstance(r, parsing.Function):
|
elif isinstance(r, parsing.Function):
|
||||||
r = Function(r)
|
r = Function(r)
|
||||||
res_new.append(r)
|
res_new.append(r)
|
||||||
debug.dbg('sfn remove, new: %s, old: %s' % (res_new, result))
|
print scope
|
||||||
|
debug.dbg(a+'sfn remove, new: %s, old: %s' % (res_new, result))
|
||||||
return res_new
|
return res_new
|
||||||
|
|
||||||
def filter_name(scope_generator):
|
def filter_name(scope_generator):
|
||||||
def handle_non_arrays(name):
|
def handle_non_arrays(name):
|
||||||
result = []
|
result = []
|
||||||
|
if isinstance(scope, InstanceElement) \
|
||||||
|
and scope.var == name.parent.parent:
|
||||||
|
name = InstanceElement(scope.instance, name)
|
||||||
par = name.parent
|
par = name.parent
|
||||||
if isinstance(par, parsing.Flow):
|
if isinstance(par, parsing.Flow):
|
||||||
if par.command == 'for':
|
if par.command == 'for':
|
||||||
@@ -893,16 +901,6 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
|||||||
else:
|
else:
|
||||||
inst = Instance(Class(par.parent.parent))
|
inst = Instance(Class(par.parent.parent))
|
||||||
result.append(inst)
|
result.append(inst)
|
||||||
elif isinstance(par, (InstanceElement)) \
|
|
||||||
and hasattr(par, 'get_descriptor_return'):
|
|
||||||
# handle descriptors
|
|
||||||
try:
|
|
||||||
result += par.get_descriptor_return(scope)
|
|
||||||
except KeyError:
|
|
||||||
result.append(par)
|
|
||||||
elif (isinstance(scope, InstanceElement)
|
|
||||||
and scope.var == par.parent):
|
|
||||||
result.append(InstanceElement(scope.instance, par))
|
|
||||||
else:
|
else:
|
||||||
result.append(par)
|
result.append(par)
|
||||||
return result
|
return result
|
||||||
@@ -932,16 +930,32 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
|||||||
# if there are results, ignore the other scopes
|
# if there are results, ignore the other scopes
|
||||||
if result:
|
if result:
|
||||||
break
|
break
|
||||||
debug.dbg('sfn filter "%s" in %s: %s' % (name_str, scope, result))
|
debug.dbg(a+'sfn filter "%s" in %s: %s' % (name_str, scope, result))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def descriptor_check(result):
|
||||||
|
res_new = []
|
||||||
|
print 'descc', scope, result, name_str
|
||||||
|
for r in result:
|
||||||
|
if isinstance(scope, (Instance)) \
|
||||||
|
and hasattr(r, 'get_descriptor_return'):
|
||||||
|
# handle descriptors
|
||||||
|
try:
|
||||||
|
res_new += r.get_descriptor_return(scope)
|
||||||
|
continue
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
res_new.append(r)
|
||||||
|
return res_new
|
||||||
|
|
||||||
|
import random; a = str(random.randint(0,99))
|
||||||
if search_global:
|
if search_global:
|
||||||
scope_generator = get_names_for_scope(scope, position=position)
|
scope_generator = get_names_for_scope(scope, position=position)
|
||||||
else:
|
else:
|
||||||
names = get_defined_names_for_position(scope, position)
|
names = get_defined_names_for_position(scope, position)
|
||||||
scope_generator = iter([(scope, names)])
|
scope_generator = iter([(scope, names)])
|
||||||
|
|
||||||
return remove_statements(filter_name(scope_generator))
|
return descriptor_check(remove_statements(filter_name(scope_generator)))
|
||||||
|
|
||||||
|
|
||||||
def assign_tuples(tup, results, seek_name):
|
def assign_tuples(tup, results, seek_name):
|
||||||
|
|||||||
Reference in New Issue
Block a user