1
0
forked from VimPlug/jedi

Fix issues with copying children in combination with InstanceElement.

This commit is contained in:
Dave Halter
2014-10-28 13:33:40 +01:00
parent b550f67bce
commit 1cc1d4480b
2 changed files with 13 additions and 7 deletions

View File

@@ -61,6 +61,8 @@ class NameFinder(object):
if search_global:
return get_names_of_scope(self._evaluator, self.scope, self.position)
else:
if self.scope.isinstance(er.Function):
return iter([(self.scope, self.scope.get_magic_function_names())])
return self.scope.scope_names_generator(self.position)
def filter_name(self, scope_names_generator):
@@ -74,7 +76,6 @@ class NameFinder(object):
names = []
self.maybe_descriptor = isinstance(self.scope, er.Class)
for name_list_scope, name_list in scope_names_generator:
print(name_list_scope)
break_scopes = []
if not isinstance(name_list_scope, compiled.CompiledObject):
# Here is the position stuff happening (sorting of variables).

View File

@@ -289,10 +289,15 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)):
func = get_instance_el(self._evaluator, self.instance, func)
return func
def expression_list(self):
def get_rhs(self):
return get_instance_el(self._evaluator, self.instance,
self.var.get_rhs(), self.is_class_var)
@property
def children(self):
# Copy and modify the array.
return [get_instance_el(self._evaluator, self.instance, command, self.is_class_var)
for command in self.var.expression_list()]
for command in self.var.children]
@property
@underscore_memoization
@@ -488,9 +493,6 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)):
f = Function(self._evaluator, f, True)
return f
def scope_names_generator(self, position=None):
yield self, self.get_magic_function_names()
def get_decorated_func(self):
"""
This function exists for the sole purpose of returning itself if the
@@ -644,7 +646,10 @@ class FunctionExecution(Executed):
@common.safe_property
@memoize_default([])
def children(self):
return self._copy_list(self.base.children)
children = self.base.children
if isinstance(self.base, InstanceElement):
children = self.base.var.children
return self._copy_list(children)
@common.safe_property
@memoize_default([])