mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-17 19:15:55 +08:00
Start to change the logic for self.foo variables.
This commit is contained in:
@@ -164,17 +164,14 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
|||||||
# because to follow them and their self variables is too
|
# because to follow them and their self variables is too
|
||||||
# complicated.
|
# complicated.
|
||||||
sub = self._get_method_execution(sub)
|
sub = self._get_method_execution(sub)
|
||||||
print(sub.get_names_dict())
|
for per_name_list in sub.get_names_dict().values():
|
||||||
for n in sub.get_defined_names():
|
for call in per_name_list:
|
||||||
# Only names with the selfname are being added.
|
if unicode(call.name) == self_name \
|
||||||
# It is also important, that they have a len() of 2,
|
and isinstance(call.next, pr.Call) \
|
||||||
# because otherwise, they are just something else
|
and call.next.next is None:
|
||||||
if isinstance(n, pr.NamePart):
|
names.append(get_instance_el(self._evaluator, self, call.next.name))
|
||||||
# NamePart currently means a function
|
#if unicode(n.names[0]) == self_name and len(n.names) == 2:
|
||||||
# TODO change this branch to scan properly for self names.
|
# add_self_dot_name(n)
|
||||||
continue
|
|
||||||
if unicode(n.names[0]) == self_name and len(n.names) == 2:
|
|
||||||
add_self_dot_name(n)
|
|
||||||
|
|
||||||
for s in self.base.py__bases__(self._evaluator):
|
for s in self.base.py__bases__(self._evaluator):
|
||||||
if not isinstance(s, compiled.CompiledObject):
|
if not isinstance(s, compiled.CompiledObject):
|
||||||
@@ -540,6 +537,12 @@ class LazyDict(object):
|
|||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
return self._copy_func(self._old_dct[key])
|
return self._copy_func(self._old_dct[key])
|
||||||
|
|
||||||
|
@underscore_memoization
|
||||||
|
def values(self):
|
||||||
|
# TODO REMOVE this. Not necessary with correct name lookups.
|
||||||
|
for calls in self._old_dct.values():
|
||||||
|
yield self._copy_func(calls)
|
||||||
|
|
||||||
|
|
||||||
class FunctionExecution(Executed):
|
class FunctionExecution(Executed):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -976,15 +976,11 @@ class Statement(Simple, DocstringMixin):
|
|||||||
for stmt in call:
|
for stmt in call:
|
||||||
search_calls(stmt.expression_list())
|
search_calls(stmt.expression_list())
|
||||||
elif isinstance(call, Call):
|
elif isinstance(call, Call):
|
||||||
c = call
|
|
||||||
# Check if there's an execution in it, if so this is
|
# Check if there's an execution in it, if so this is
|
||||||
# not a set_var.
|
# not a set_var.
|
||||||
while c:
|
if not call.next:
|
||||||
if isinstance(c.next, Array):
|
|
||||||
break
|
|
||||||
c = c.next
|
|
||||||
else:
|
|
||||||
self._set_vars.append(call.name)
|
self._set_vars.append(call.name)
|
||||||
|
continue
|
||||||
|
|
||||||
self._set_vars = []
|
self._set_vars = []
|
||||||
for calls, operation in self.assignment_details:
|
for calls, operation in self.assignment_details:
|
||||||
|
|||||||
Reference in New Issue
Block a user