forked from VimPlug/jedi
The func/class dictionaries must be changed if some scopes are removed by the parser's error recovery.
This commit is contained in:
@@ -243,6 +243,9 @@ class Parser(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass # This may happen with CompFor.
|
pass # This may happen with CompFor.
|
||||||
|
|
||||||
|
for dfa, state, node in stack[start_index:]:
|
||||||
|
clear_names(children=node[1])
|
||||||
|
|
||||||
failed_stack = []
|
failed_stack = []
|
||||||
found = False
|
found = False
|
||||||
for dfa, state, (typ, nodes) in stack[start_index:]:
|
for dfa, state, (typ, nodes) in stack[start_index:]:
|
||||||
@@ -251,13 +254,12 @@ class Parser(object):
|
|||||||
if found:
|
if found:
|
||||||
symbol = grammar.number2symbol[typ]
|
symbol = grammar.number2symbol[typ]
|
||||||
failed_stack.append((symbol, nodes))
|
failed_stack.append((symbol, nodes))
|
||||||
|
if nodes and nodes[0] in ('def', 'class'):
|
||||||
|
self.scope_names_stack.pop()
|
||||||
if failed_stack:
|
if failed_stack:
|
||||||
err = ErrorStatement(failed_stack, value, start_pos)
|
err = ErrorStatement(failed_stack, value, start_pos)
|
||||||
self.error_statement_stacks.append(err)
|
self.error_statement_stacks.append(err)
|
||||||
|
|
||||||
for dfa, state, node in stack[start_index:]:
|
|
||||||
clear_names(children=node[1])
|
|
||||||
|
|
||||||
stack[start_index:] = []
|
stack[start_index:] = []
|
||||||
|
|
||||||
def _tokenize(self, tokenizer):
|
def _tokenize(self, tokenizer):
|
||||||
|
|||||||
Reference in New Issue
Block a user