irx.analysis.factories

irx.analysis.factories

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

title: Semantic entity factories.
summary: >-
  Build semantic sidecar entities and visible binding wrappers in one place so
  analyzer visitors can focus on traversal and rule orchestration.

Classes

SemanticEntityFactory

title: Central semantic entity construction.
summary: >-
  Create semantic symbols, functions, structs, modules, and visible
  bindings with consistent ids and qualified names.
attributes:
  context:
    type: SemanticContext

Methods

make_variable_symbol(self, module_key: ModuleKey, name: str, type_: astx.DataType, *, is_mutable: bool, declaration: astx.AST | None, kind: str='variable') -> SemanticSymbol
title: Create a variable-like semantic symbol.
parameters:
  module_key:
    type: ModuleKey
  name:
    type: str
  type_:
    type: astx.DataType
  is_mutable:
    type: bool
  declaration:
    type: astx.AST | None
  kind:
    type: str
returns:
  type: SemanticSymbol
make_parameter_symbol(self, module_key: ModuleKey, argument: astx.Argument) -> SemanticSymbol
title: Create one function-parameter semantic symbol.
parameters:
  module_key:
    type: ModuleKey
  argument:
    type: astx.Argument
returns:
  type: SemanticSymbol
make_parameter_spec(self, argument: astx.Argument) -> ParameterSpec
title: Create one canonical semantic parameter specification.
parameters:
  argument:
    type: astx.Argument
returns:
  type: ParameterSpec
make_function_signature(self, prototype: astx.FunctionPrototype, *, calling_convention: CallingConvention, is_variadic: bool, is_extern: bool, symbol_name: str, required_runtime_features: tuple[str, ...]=(), ffi: FFICallableInfo | None=None) -> FunctionSignature
title: Create one canonical semantic function signature.
parameters:
  prototype:
    type: astx.FunctionPrototype
  calling_convention:
    type: CallingConvention
  is_variadic:
    type: bool
  is_extern:
    type: bool
  symbol_name:
    type: str
  required_runtime_features:
    type: tuple[str, Ellipsis]
  ffi:
    type: FFICallableInfo | None
returns:
  type: FunctionSignature
make_function(self, module_key: ModuleKey, prototype: astx.FunctionPrototype, *, signature: FunctionSignature, definition: astx.FunctionDef | None=None, args: tuple[SemanticSymbol, ...] | None=None) -> SemanticFunction
title: Create one semantic function entity.
parameters:
  module_key:
    type: ModuleKey
  prototype:
    type: astx.FunctionPrototype
  signature:
    type: FunctionSignature
  definition:
    type: astx.FunctionDef | None
  args:
    type: tuple[SemanticSymbol, Ellipsis] | None
returns:
  type: SemanticFunction
make_callable_resolution(self, function: SemanticFunction) -> CallableResolution
title: Create one resolved callable wrapper.
parameters:
  function:
    type: SemanticFunction
returns:
  type: CallableResolution
make_struct(self, module_key: ModuleKey, node: astx.StructDefStmt) -> SemanticStruct
title: Create one semantic struct entity.
parameters:
  module_key:
    type: ModuleKey
  node:
    type: astx.StructDefStmt
returns:
  type: SemanticStruct
make_class(self, module_key: ModuleKey, node: astx.ClassDefStmt) -> SemanticClass
title: Create one semantic class entity.
parameters:
  module_key:
    type: ModuleKey
  node:
    type: astx.ClassDefStmt
returns:
  type: SemanticClass
make_class_member(self, class_: SemanticClass, *, name: str, kind: ClassMemberKind, declaration: astx.AST, visibility: astx.VisibilityKind, is_static: bool, is_constant: bool, is_mutable: bool, is_abstract: bool=False, type_: astx.DataType | None=None, signature: FunctionSignature | None=None, signature_key: str | None=None, overrides: str | None=None, dispatch_slot: int | None=None, lowered_function: SemanticFunction | None=None) -> SemanticClassMember
title: Create one semantic class-member record.
parameters:
  class_:
    type: SemanticClass
  name:
    type: str
  kind:
    type: ClassMemberKind
  declaration:
    type: astx.AST
  visibility:
    type: astx.VisibilityKind
  is_static:
    type: bool
  is_constant:
    type: bool
  is_mutable:
    type: bool
  is_abstract:
    type: bool
  type_:
    type: astx.DataType | None
  signature:
    type: FunctionSignature | None
  signature_key:
    type: str | None
  overrides:
    type: str | None
  dispatch_slot:
    type: int | None
  lowered_function:
    type: SemanticFunction | None
returns:
  type: SemanticClassMember
make_module(self, module_key: ModuleKey, *, display_name: str | None=None) -> SemanticModule
title: Create one semantic module entity.
parameters:
  module_key:
    type: ModuleKey
  display_name:
    type: str | None
returns:
  type: SemanticModule
make_function_binding(self, function: SemanticFunction) -> SemanticBinding
title: Create a visible binding for a function.
parameters:
  function:
    type: SemanticFunction
returns:
  type: SemanticBinding
make_struct_binding(self, struct: SemanticStruct) -> SemanticBinding
title: Create a visible binding for a struct.
parameters:
  struct:
    type: SemanticStruct
returns:
  type: SemanticBinding
make_class_binding(self, class_: SemanticClass) -> SemanticBinding
title: Create a visible binding for a class.
parameters:
  class_:
    type: SemanticClass
returns:
  type: SemanticBinding
make_module_binding(self, module: SemanticModule) -> SemanticBinding
title: Create a visible binding for a module.
parameters:
  module:
    type: SemanticModule
returns:
  type: SemanticBinding
make_import_binding(self, *, local_name: str, requested_name: str, source_module_key: ModuleKey, binding: SemanticBinding) -> ResolvedImportBinding
title: Create one resolved import binding record.
parameters:
  local_name:
    type: str
  requested_name:
    type: str
  source_module_key:
    type: ModuleKey
  binding:
    type: SemanticBinding
returns:
  type: ResolvedImportBinding