def visit(self, node: ClassDeclarationNode): if Utils.IsBasicType(node.id): error_text = SemanticError.REDEFINITION_ERROR % node.id self.errors.append(SemanticError(*node.pos, error_text)) try: self.context.create_type(node.id, node.pos) except SemanticError as exception: self.errors.append(exception) if not node.parent: node.parent = 'Object'