forked from VimPlug/jedi
Remove a comprehension hack in the parser that would have made the diff parsers world hell.
This commit is contained in:
@@ -193,11 +193,6 @@ class Parser(object):
|
||||
arr = self._scope_names_stack[-1].setdefault(n.value, [])
|
||||
arr.append(n)
|
||||
new_node.names_dict = scope_names
|
||||
elif isinstance(new_node, pt.CompFor):
|
||||
# The name definitions of comprehenions shouldn't be part of the
|
||||
# current scope. They are part of the comprehension scope.
|
||||
for n in new_node.get_defined_names():
|
||||
self._scope_names_stack[-1][n.value].remove(n)
|
||||
return new_node
|
||||
|
||||
def convert_leaf(self, grammar, type, value, prefix, start_pos):
|
||||
|
||||
@@ -173,6 +173,7 @@ class DiffParser(object):
|
||||
self._old_module = self._new_module
|
||||
|
||||
assert self._new_module.end_pos[0] == line_length
|
||||
|
||||
return self._new_module
|
||||
|
||||
def _copy_from_old_parser(self, line_offset, until_line_old, until_line_new):
|
||||
@@ -225,6 +226,9 @@ class DiffParser(object):
|
||||
self._update_positions(nodes, line_offset)
|
||||
parent = self._insert_nodes(nodes)
|
||||
self._update_names_dict(parent, nodes)
|
||||
self._copied_ranges.append(
|
||||
(nodes[0].start_pos[0], _get_last_line(nodes[-1]))
|
||||
)
|
||||
# We have copied as much as possible (but definitely not too
|
||||
# much). Therefore we just parse the rest.
|
||||
# We might not reach the end, because there's a statement
|
||||
@@ -469,7 +473,7 @@ class DiffParser(object):
|
||||
for key, names in self._old_module.used_names.items():
|
||||
for name in names:
|
||||
if name.start_pos[0] in copied_line_numbers:
|
||||
new_used_names.setdefault(key, []).add(name)
|
||||
new_used_names.setdefault(key, []).append(name)
|
||||
|
||||
# Add an endmarker.
|
||||
last_leaf = self._new_module.last_leaf()
|
||||
|
||||
Reference in New Issue
Block a user