From 89a2cb15d08263c2c3dc5c7adbfecd382a24ab87 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sun, 17 Feb 2013 00:14:30 +0430 Subject: [PATCH] fix problems with positions in definitions with the same name on the same line --- jedi/evaluate.py | 8 ++++++-- jedi/parsing_representation.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/jedi/evaluate.py b/jedi/evaluate.py index 3bf5f926..127f77b0 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -634,8 +634,12 @@ def follow_call_list(call_list, follow_array=False): def follow_call(call): """Follow a call is following a function, variable, string, etc.""" path = call.generate_call_path() - scope = call.get_parent_until(pr.IsScope) - return follow_call_path(path, scope, call.start_pos) + + # find the statement of the Scope + s = call + while not s.parent.isinstance(pr.IsScope): + s = s.parent + return follow_call_path(path, s.parent, s.start_pos) def follow_call_path(path, scope, position): diff --git a/jedi/parsing_representation.py b/jedi/parsing_representation.py index 43b82d5d..cda636fd 100644 --- a/jedi/parsing_representation.py +++ b/jedi/parsing_representation.py @@ -253,7 +253,7 @@ class Scope(Simple, IsScope): self.start_pos[0], self.end_pos[0]) -class Module(object): +class Module(IsScope): """ For isinstance checks. fast_parser.Module also inherits from this. """ pass