From e6741c2dd66b06202bd87560859e2451bc39764a Mon Sep 17 00:00:00 2001 From: David Halter Date: Sat, 14 Jul 2012 17:28:43 +0200 Subject: [PATCH] fixed the position problems, that came with the last big patch --- evaluate.py | 16 ++++++++-------- functions.py | 5 ++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/evaluate.py b/evaluate.py index 179934cb..8117e2ec 100644 --- a/evaluate.py +++ b/evaluate.py @@ -647,14 +647,14 @@ class Generator(object): content of a generator. """ names = [] - for n in ['__next__', 'send']: - # The name for the `next` function. - name = parsing.Name([n], 0, 0, 0) - name.parent = self - names.append(name) - for n in ['close', 'throw']: - name = parsing.Name([n], 0, 0, 0) - name.parent = None + none_pos = (None,None) + executes_generator = ('__next__', 'send') + for n in ('close', 'throw') + executes_generator: + name = parsing.Name([n], none_pos, none_pos) + if n in executes_generator: + name.parent = self + else: + name.parent = None names.append(name) debug.dbg('generator names', names) return names diff --git a/functions.py b/functions.py index 93c64789..b8c3f392 100644 --- a/functions.py +++ b/functions.py @@ -94,7 +94,7 @@ class Definition(object): return path def get_line(self): - return self.scope.line_nr + return self.scope.start_pos[0] def get_indent(self): return self.scope.indent @@ -194,8 +194,7 @@ def prepare_goto(source, position, source_path, is_like_search): path_tuple = () raise NotFoundError(scope, path_tuple) else: - stmt.line_nr = position[0] - stmt.indent = position[1] + stmt.start_pos = position stmt.parent = scope scopes = evaluate.follow_statement(stmt)