diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index 61249236..9bf3e1b9 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -446,30 +446,30 @@ class Evaluator(object): return types def goto_definitions(self, context, name): - is_simple_name = name.parent.type not in ('power', 'trailer') - if is_simple_name: - def_ = name._get_definition() - if def_ is not None: - type_ = def_.type - if type_ == 'classdef': - return [er.ClassContext(self, name.parent, context)] - elif type_ == 'funcdef': - return [er.FunctionContext(self, context, name.parent)] + def_ = name._get_definition() + if def_ is not None: + type_ = def_.type + if type_ == 'classdef': + return [er.ClassContext(self, name.parent, context)] + elif type_ == 'funcdef': + return [er.FunctionContext(self, context, name.parent)] - if type_ == 'expr_stmt': + if type_ == 'expr_stmt': + is_simple_name = name.parent.type not in ('power', 'trailer') + if is_simple_name: return self.eval_statement(context, def_, name) - if type_ == 'for_stmt': - container_types = self.eval_element(context, def_.children[3]) - cn = ContextualizedNode(context, def_.children[3]) - for_types = iterable.py__iter__types(self, container_types, cn) - c_node = ContextualizedName(context, name) - return finder.check_tuple_assignments(self, c_node, for_types) - if type_ in ('import_from', 'import_name'): - return imports.infer_import(context, name) - else: - imp = tree.search_ancestor(name, 'import_from', 'import_name') - if imp is not None: - return imports.infer_import(context, name) + if type_ == 'for_stmt': + container_types = self.eval_element(context, def_.children[3]) + cn = ContextualizedNode(context, def_.children[3]) + for_types = iterable.py__iter__types(self, container_types, cn) + c_node = ContextualizedName(context, name) + return finder.check_tuple_assignments(self, c_node, for_types) + if type_ in ('import_from', 'import_name'): + return imports.infer_import(context, name) + else: + imp = tree.search_ancestor(name, 'import_from', 'import_name') + if imp is not None: + return imports.infer_import(context, name) return helpers.evaluate_call_of_leaf(context, name)