def semantic_check(self, scope): try: self._semantic_check_before_children(scope) for child in self.iter_ast_children(): child.semantic_check(scope) self._semantic_check_after_children(scope) except RuleCheckError as e: if e.scope is None: e.scope = scope if e.source_span is None: e.source_span = SourceSpan.copy(self.source_span) raise e
def _set_source_span(node, from_item, to_item=None): if to_item is None: node.source_span = SourceSpan.copy(from_item.source_span) else: node.source_span = SourceSpan.from_to(from_item.source_span, to_item.source_span)
def __init__(self, source_span=None, **error_parameters): super().__init__(**error_parameters) self.source_span = SourceSpan.copy(source_span)