irx.analysis.registry

irx.analysis.registry

Source: packages/irx/src/irx/analysis/registry.py

title: Semantic registration helpers.
summary: >-
  Centralize semantic declaration and top-level registration policy so the
  analyzer delegates identity and duplicate handling to a smaller subsystem.

Classes

SemanticRegistry

title: Semantic entity registration policy.
summary: >-
  Register locals, functions, and structs while enforcing the duplicate
  declaration rules that semantic analysis currently exposes.
attributes:
  context:
    type: SemanticContext
  factory:
    type: SemanticEntityFactory

Methods

signatures_match(self, lhs: FunctionSignature, rhs: FunctionSignature) -> bool
title: Return whether two canonical function signatures match.
parameters:
  lhs:
    type: FunctionSignature
  rhs:
    type: FunctionSignature
returns:
  type: bool
normalize_function_signature(self, prototype: astx.FunctionPrototype, *, definition: astx.FunctionDef | None=None, validate_ffi: bool=True, validate_main: bool=True) -> FunctionSignature
title: Normalize and validate one semantic function signature.
parameters:
  prototype:
    type: astx.FunctionPrototype
  definition:
    type: astx.FunctionDef | None
  validate_ffi:
    type: bool
  validate_main:
    type: bool
returns:
  type: FunctionSignature
declare_local(self, name: str, type_: astx.DataType, *, is_mutable: bool, declaration: astx.AST, kind: str='variable') -> SemanticSymbol
title: Declare one lexical symbol.
parameters:
  name:
    type: str
  type_:
    type: astx.DataType
  is_mutable:
    type: bool
  declaration:
    type: astx.AST
  kind:
    type: str
returns:
  type: SemanticSymbol
register_function(self, prototype: astx.FunctionPrototype, *, definition: astx.FunctionDef | None=None, validate_ffi: bool=True) -> SemanticFunction
title: Register one top-level function.
parameters:
  prototype:
    type: astx.FunctionPrototype
  definition:
    type: astx.FunctionDef | None
  validate_ffi:
    type: bool
returns:
  type: SemanticFunction
register_struct(self, node: astx.StructDefStmt) -> SemanticStruct
title: Register one top-level struct.
parameters:
  node:
    type: astx.StructDefStmt
returns:
  type: SemanticStruct
register_class(self, node: astx.ClassDefStmt) -> SemanticClass
title: Register one top-level class.
parameters:
  node:
    type: astx.ClassDefStmt
returns:
  type: SemanticClass
resolve_function(self, name: str, *, module_key: ModuleKey | None=None) -> SemanticFunction | None
title: Resolve one registered function.
parameters:
  name:
    type: str
  module_key:
    type: ModuleKey | None
returns:
  type: SemanticFunction | None
resolve_class(self, name: str, *, module_key: ModuleKey | None=None) -> SemanticClass | None
title: Resolve one registered class.
parameters:
  name:
    type: str
  module_key:
    type: ModuleKey | None
returns:
  type: SemanticClass | None
resolve_struct(self, name: str, *, module_key: ModuleKey | None=None) -> SemanticStruct | None
title: Resolve one registered struct.
parameters:
  name:
    type: str
  module_key:
    type: ModuleKey | None
returns:
  type: SemanticStruct | None