diff --git a/jedi/evaluate/finder.py b/jedi/evaluate/finder.py index 459fcee0..5c3d6333 100644 --- a/jedi/evaluate/finder.py +++ b/jedi/evaluate/finder.py @@ -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). diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index 6f1f70e8..3b2d5884 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -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([])