Report duplicate object IDs

This commit is contained in:
James Westman 2021-11-03 14:58:33 -05:00
parent dfb09b9357
commit 241668fb94
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
5 changed files with 68 additions and 1 deletions

View file

@ -118,6 +118,12 @@ class AstNode:
yield from child.get_semantic_tokens()
def iterate_children_recursive(self) -> T.Iterator["AstNode"]:
yield self
for child in self.children:
yield from child.iterate_children_recursive()
def validate(token_name=None, end_token_name=None, skip_incomplete=False):
""" Decorator for functions that validate an AST node. Exceptions raised
during validation are marked with range information from the tokens. Also