goto_assignments and usages both working now with issues like #315

This commit is contained in:
Dave Halter
2014-03-29 16:37:39 +01:00
parent 29435852e6
commit ced5b6ca82
3 changed files with 26 additions and 13 deletions

View File

@@ -249,12 +249,12 @@ class Script(object):
except IndexError:
raise NotFoundError()
user_stmt = self._parser.user_stmt()
if type(user_stmt) is pr.Statement:
stmt.start_pos = user_stmt.start_pos
else:
if user_stmt is None:
# Set the start_pos to a pseudo position, that doesn't exist but works
# perfectly well (for both completions in docstrings and statements).
stmt.start_pos = self._pos
else:
stmt.start_pos = user_stmt.start_pos
stmt.parent = self._parser.user_scope()
return stmt
@@ -437,7 +437,7 @@ class Script(object):
for name in user_stmt.get_set_vars():
if name.start_pos <= self._pos <= name.end_pos \
and len(name.names) == 1:
return user_stmt, name.names[-1]
return name, name.names[-1]
return None, None
lhs, search_name = test_lhs()