diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index f531370a..94fa4c18 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -682,9 +682,6 @@ class FunctionExecution(Executed): def subscopes(self): return self._copy_list(self.base.subscopes) - def get_statement_for_position(self, pos): - return pr.Scope.get_statement_for_position(self, pos) - def __repr__(self): return "<%s of %s>" % (type(self).__name__, self.base) diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index dd26e31d..afd7fba5 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -552,10 +552,8 @@ class Scope(Simple, DocstringMixin): return True @Python3Method - def get_statement_for_position(self, pos, include_imports=False): - checks = self.statements + self.asserts - if include_imports: - checks += self.imports + def get_statement_for_position(self, pos): + checks = self.statements + self.asserts + self.imports if self.isinstance(Function): checks += self.get_decorators() checks += [r for r in self.returns if r is not None] @@ -566,7 +564,7 @@ class Scope(Simple, DocstringMixin): for s in self.subscopes: if s.start_pos <= pos <= s.end_pos: - p = s.get_statement_for_position(pos, include_imports) + p = s.get_statement_for_position(pos) if p: return p diff --git a/jedi/parser/user_context.py b/jedi/parser/user_context.py index e1ff1f5b..bc2ce171 100644 --- a/jedi/parser/user_context.py +++ b/jedi/parser/user_context.py @@ -259,7 +259,7 @@ class UserContextParser(object): def user_stmt(self): module = self.module() debug.speed('parsed') - return module.get_statement_for_position(self._position, include_imports=True) + return module.get_statement_for_position(self._position) @cache.underscore_memoization def user_stmt_with_whitespace(self): @@ -278,7 +278,7 @@ class UserContextParser(object): debug.warning('No statement under the cursor.') return pos = next(self._user_context.get_context(yield_positions=True)) - user_stmt = self.module().get_statement_for_position(pos, include_imports=True) + user_stmt = self.module().get_statement_for_position(pos) return user_stmt @cache.underscore_memoization