forked from VimPlug/jedi
Fix issues with copying children in combination with InstanceElement.
This commit is contained in:
@@ -61,6 +61,8 @@ class NameFinder(object):
|
|||||||
if search_global:
|
if search_global:
|
||||||
return get_names_of_scope(self._evaluator, self.scope, self.position)
|
return get_names_of_scope(self._evaluator, self.scope, self.position)
|
||||||
else:
|
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)
|
return self.scope.scope_names_generator(self.position)
|
||||||
|
|
||||||
def filter_name(self, scope_names_generator):
|
def filter_name(self, scope_names_generator):
|
||||||
@@ -74,7 +76,6 @@ class NameFinder(object):
|
|||||||
names = []
|
names = []
|
||||||
self.maybe_descriptor = isinstance(self.scope, er.Class)
|
self.maybe_descriptor = isinstance(self.scope, er.Class)
|
||||||
for name_list_scope, name_list in scope_names_generator:
|
for name_list_scope, name_list in scope_names_generator:
|
||||||
print(name_list_scope)
|
|
||||||
break_scopes = []
|
break_scopes = []
|
||||||
if not isinstance(name_list_scope, compiled.CompiledObject):
|
if not isinstance(name_list_scope, compiled.CompiledObject):
|
||||||
# Here is the position stuff happening (sorting of variables).
|
# Here is the position stuff happening (sorting of variables).
|
||||||
|
|||||||
@@ -289,10 +289,15 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)):
|
|||||||
func = get_instance_el(self._evaluator, self.instance, func)
|
func = get_instance_el(self._evaluator, self.instance, func)
|
||||||
return 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.
|
# Copy and modify the array.
|
||||||
return [get_instance_el(self._evaluator, self.instance, command, self.is_class_var)
|
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
|
@property
|
||||||
@underscore_memoization
|
@underscore_memoization
|
||||||
@@ -488,9 +493,6 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
f = Function(self._evaluator, f, True)
|
f = Function(self._evaluator, f, True)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
def scope_names_generator(self, position=None):
|
|
||||||
yield self, self.get_magic_function_names()
|
|
||||||
|
|
||||||
def get_decorated_func(self):
|
def get_decorated_func(self):
|
||||||
"""
|
"""
|
||||||
This function exists for the sole purpose of returning itself if the
|
This function exists for the sole purpose of returning itself if the
|
||||||
@@ -644,7 +646,10 @@ class FunctionExecution(Executed):
|
|||||||
@common.safe_property
|
@common.safe_property
|
||||||
@memoize_default([])
|
@memoize_default([])
|
||||||
def children(self):
|
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
|
@common.safe_property
|
||||||
@memoize_default([])
|
@memoize_default([])
|
||||||
|
|||||||
Reference in New Issue
Block a user