diff --git a/jedi/evaluate/helpers.py b/jedi/evaluate/helpers.py index 7a66488b..265848e9 100644 --- a/jedi/evaluate/helpers.py +++ b/jedi/evaluate/helpers.py @@ -147,7 +147,7 @@ def search_call_signatures(user_stmt, position): """ debug.speed('func_call start') call, arr, index = None, None, 0 - if user_stmt is not None and isinstance(user_stmt, pr.Statement): + if user_stmt is not None and isinstance(user_stmt, pr.ExprStmt): # some parts will of the statement will be removed user_stmt = deep_ast_copy(user_stmt) arr, index, call = call_signature_array_for_pos(user_stmt, position) @@ -284,7 +284,7 @@ class FakeArray(pr.Array): self.values = values -class FakeStatement(pr.Statement): +class FakeStatement(pr.ExprStmt): def __init__(self, expression_list, start_pos=(0, 0), parent=None): p = start_pos super(FakeStatement, self).__init__(FakeSubModule, expression_list, p, p) diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index 6f331638..60321da3 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -271,7 +271,7 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)): return pr.Simple.get_parent_until(self, *args, **kwargs) def get_definition(self): - return self.get_parent_until((pr.Statement, pr.IsScope, pr.Import)) + return self.get_parent_until((pr.ExprStmt, pr.IsScope, pr.Import)) def get_decorated_func(self): """ Needed because the InstanceElement should not be stripped """ diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index 1645e16a..2118ff70 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -1515,7 +1515,7 @@ class Name(Simple): def get_definition(self): # TODO This is way to complicated, simplify this with a new parser. - return self.get_parent_until((Statement, IsScope, Import)) + return self.get_parent_until((ExprStmt, IsScope, Import)) @property def end_pos(self):