diff --git a/jedi/api/classes.py b/jedi/api/classes.py index 21a3a930..e7ec9000 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -360,7 +360,7 @@ class BaseDefinition(object): if isinstance(self._definition, compiled.CompiledObject): non_flow = self._definition.parent else: - scope = self._definition.get_parent_scope(include_current=False) + scope = self._definition.get_parent_scope() non_flow = scope.get_parent_until(pr.Flow, reverse=True) return Definition(self._evaluator, non_flow) diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index 4bbd0567..4317487f 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -220,13 +220,12 @@ class Evaluator(object): """Follow a call is following a function, variable, string, etc.""" path = call.generate_call_path() - # TODO use scope_parent # find the statement of the Scope s = call while not s.parent.is_scope(): s = s.parent - par = s.parent - return self.eval_call_path(path, par, s.start_pos) + scope = s.parent + return self.eval_call_path(path, scope, s.start_pos) def eval_call_path(self, path, scope, position): """ diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index 56262090..cfe0e2be 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -140,11 +140,11 @@ class Base(object): scope = scope.parent return scope - def get_parent_scope(self, include_current=True): + def get_parent_scope(self): """ Returns the underlying scope. """ - scope = self if include_current else self.parent + scope = self.parent while scope.parent is not None: if scope.is_scope(): break