Add a check to see if leaves have the right start positions

This commit is contained in:
Dave Halter
2018-12-28 02:05:27 +01:00
parent ada84ed063
commit 29456a6c0a

View File

@@ -41,6 +41,11 @@ def _assert_valid_graph(node):
try:
children = node.children
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
for child in children: