Skip to content

declarations

Handle modules, functions, structs, and lexical declarations while delegating semantic entity creation and registration to shared infrastructure.

Classes:

DeclarationVisitorMixin

Bases: SemanticVisitorMixinBase

Methods:

visit

visit(node: StructDefStmt) -> None
Source code in src/irx/analysis/handlers/declarations.py
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
@SemanticAnalyzerCore.visit.dispatch
def visit(self, node: astx.StructDefStmt) -> None:
    """
    title: Visit StructDefStmt nodes.
    parameters:
      node:
        type: astx.StructDefStmt
    """
    struct = self.registry.register_struct(node)
    self.bindings.bind_struct(node.name, struct, node=node)
    struct = self._resolve_struct_fields(struct)
    self._set_struct(node, struct)
    self._validate_struct_cycles(struct)
    self._set_type(node, None)