Skip to content

structs

Resolve struct field metadata and reject invalid by-value recursive struct definitions.

Classes:

DeclarationStructVisitorMixin

Bases: SemanticVisitorMixinBase

Methods:

visit

visit(node: StructDefStmt) -> None
Source code in packages/irx/src/irx/analysis/handlers/_declarations/structs.py
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@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)