mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-08 05:34:51 +08:00
Add a check to see if leaves have the right start positions
This commit is contained in:
@@ -41,6 +41,11 @@ def _assert_valid_graph(node):
|
|||||||
try:
|
try:
|
||||||
children = node.children
|
children = node.children
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
previous_leaf = node.get_previous_leaf()
|
||||||
|
if previous_leaf is not None:
|
||||||
|
if previous_leaf.type != 'error_leaf' or previous_leaf.token_type != 'INDENT':
|
||||||
|
assert previous_leaf.end_pos == node.get_start_pos_of_prefix(), \
|
||||||
|
(previous_leaf, node)
|
||||||
return
|
return
|
||||||
|
|
||||||
for child in children:
|
for child in children:
|
||||||
|
|||||||
Reference in New Issue
Block a user