From 7619bf27d1865d50fad7f1a0c5fcee4beaffafa5 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 18 Aug 2014 15:00:14 +0200 Subject: [PATCH] Simplify goto_definition in case it done on a function. --- jedi/api/__init__.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 57718790..f09e9204 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -379,16 +379,9 @@ class Script(object): else: # Fetch definition of callee, if there's no path otherwise. if not goto_path: - (call, _, _) = search_call_signatures(user_stmt, self._pos) + call, _, _ = search_call_signatures(user_stmt, self._pos) if call is not None: - while call.next is not None: - call = call.next - # reset cursor position: - (row, col) = call.name.end_pos - pos = (row, max(col - 1, 0)) - self._user_context = UserContext(self.source, pos) - # then try to find the path again - goto_path = self._user_context.get_path_under_cursor() + definitions = set(self._evaluator.eval_call(call)) if not definitions: if goto_path: