1
0
forked from VimPlug/jedi

fix end_pos stuff in parser (no (None, None) end_pos anymore

This commit is contained in:
David Halter
2013-05-03 01:14:41 +04:30
parent 4bb4176296
commit 302d06de85
2 changed files with 6 additions and 2 deletions

View File

@@ -357,6 +357,7 @@ class FastParser(use_metaclass(CachedFastParser)):
if self.current_node.parent and (isinstance(p.user_scope, if self.current_node.parent and (isinstance(p.user_scope,
pr.SubModule) or p.user_scope is None) \ pr.SubModule) or p.user_scope is None) \
and self.user_position \
and p.start_pos <= self.user_position < p.end_pos: and p.start_pos <= self.user_position < p.end_pos:
p.user_scope = self.current_node.parent.content_scope p.user_scope = self.current_node.parent.content_scope

View File

@@ -430,8 +430,11 @@ class Parser(object):
except (StopIteration, common.MultiLevelStopIteration): except (StopIteration, common.MultiLevelStopIteration):
# on finish, set end_pos correctly # on finish, set end_pos correctly
s = self.scope s = self.scope
while s is not None and not (isinstance(s, pr.Module) while s is not None:
and not isinstance(s, pr.SubModule)): if isinstance(s, pr.Module) \
and not isinstance(s, pr.SubModule):
self.module.end_pos = self.end_pos
break
s.end_pos = self.end_pos s.end_pos = self.end_pos
s = s.parent s = s.parent
raise raise