From 747e0aa7c41ea852ce82ed93f7d197cddf7b4090 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 2 Sep 2017 23:23:09 +0200 Subject: [PATCH] Remove a get_definition usage. --- jedi/evaluate/__init__.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/jedi/evaluate/__init__.py b/jedi/evaluate/__init__.py index 9bf3e1b9..47f09253 100644 --- a/jedi/evaluate/__init__.py +++ b/jedi/evaluate/__init__.py @@ -340,12 +340,10 @@ class Evaluator(object): """ if atom.type == 'name': # This is the first global lookup. - stmt = atom.get_definition() - if stmt.type == 'comp_for': - stmt = tree.search_ancestor(stmt, 'expr_stmt', 'lambdef', 'funcdef', 'classdef') - if stmt is None or stmt.type != 'expr_stmt': - # We only need to adjust the start_pos for statements, because - # there the name cannot be used. + stmt = tree.search_ancestor( + atom, 'expr_stmt', 'lambdef' + ) or atom + if stmt.type == 'lambdef': stmt = atom return context.py__getattribute__( name_or_str=atom,