API reference
python:irx:irx.analysis.context.SemanticContext
class SemanticContext
SemanticContext(scopes: ScopeStack = ScopeStack(), diagnostics: DiagnosticBag = DiagnosticBag(), functions: dict[tuple[ModuleKey, str], SemanticFunction] = dict(), structs: dict[tuple[ModuleKey, str], SemanticStruct] = dict(), classes: dict[tuple[ModuleKey, str], SemanticClass] = dict(), current_function: SemanticFunction | None = None, current_class: SemanticClass | None = None, current_module_key: ModuleKey | None = None, check_constant_expressions: bool = True, loop_depth: int = 0, exception_region_depth: int = 0, native_feature_names: tuple[str, ...] = (), native_bindings: dict[int, tuple[str, ...]] = dict(), native_table_io: dict[int, TableIOOperation] = dict(), exception_declarations: tuple[astx.ClassDefStmt, ...] = (), runtime_exception_types: dict[str, ResolvedExceptionType] = dict(), _symbol_counter: int = 0, _method_slot_counter: int = 0)
Source: packages/irx/src/irx/analysis/context.py:31
Shared semantic-analysis state.
Store scopes, diagnostics, module-aware top-level registries, and transient current-node context for the analyzer.
Attributes
-
scopes — Type: ScopeStack
-
diagnostics — Type: DiagnosticBag
-
functions — Type: dict[tuple[ModuleKey, str], SemanticFunction]
-
structs — Type: dict[tuple[ModuleKey, str], SemanticStruct]
-
classes — Type: dict[tuple[ModuleKey, str], SemanticClass]
-
current_function — Type: SemanticFunction | None
-
current_class — Type: SemanticClass | None
-
current_module_key — Type: ModuleKey | None
-
check_constant_expressions — Type: bool
-
loop_depth — Type: int
-
exception_region_depth — Type: int
-
native_feature_names — Type: tuple[str, Ellipsis]
-
native_bindings — Type: dict[int, tuple[str, Ellipsis]]
-
native_table_io — Type: dict[int, TableIOOperation]
-
exception_declarations — Type: tuple[astx.ClassDefStmt, Ellipsis]
-
runtime_exception_types — Type: dict[str, ResolvedExceptionType]
-
_symbol_counter — Type: int
-
_method_slot_counter — Type: int
Methods
-
__init__ —
-
constant_diagnostics — Suppress operation errors in possibly unevaluated branches.
-
get_class — Return a top-level class by module and name.
-
get_function — Return a top-level function by module and name.
-
get_struct — Return a top-level struct by module and name.
-
in_class — Temporarily set current_class.
-
in_function — Temporarily set current_function.
-
in_loop — Increase loop depth for loop analysis.
-
in_module — Temporarily set the current module key.
-
next_method_slot — Return a fresh class-method dispatch slot.
-
next_symbol_id — Return a fresh semantic symbol id.
-
register_class — Register a top-level class by module and name.
-
register_function — Register a top-level function by module and name.
-
register_struct — Register a top-level struct by module and name.
-
scope — Push/pop a scope around a block of work.