irx.builder.lowering.exceptions

irx.builder.lowering.exceptions

Source: packages/irx/src/irx/builder/lowering/exceptions.py

title: Explicit status propagation and lexical exception exit regions.

Classes

ExceptionVisitorMixin(VisitorMixinBase)

title: Lower resolved exceptions without foreign stack unwinding.

Methods

exception_call(self, operation: str, args: list[ir.Value]) -> ir.Value
title: Call one registered opaque exception-runtime operation.
parameters:
  operation:
    type: str
  args:
    type: list[ir.Value]
returns:
  type: ir.Value
context_value(self) -> ir.Value
title: Require the execution context of a generated frame.
returns:
  type: ir.Value
exception_string(self, value: str) -> ir.Value
title: Materialize an immutable native diagnostic string.
parameters:
  value:
    type: str
returns:
  type: ir.Value
exception_location(self, node: astx.AST) -> list[ir.Value]
title: Preserve the source location supplied by semantic analysis.
parameters:
  node:
    type: astx.AST
returns:
  type: list[ir.Value]
emit_resolved_call(self, node: astx.AST, callee: ir.Value, signature: FunctionSignature, args: list[ir.Value]) -> ir.Value | None
title: Read an ABI result slot only on the successful status edge.
parameters:
  node:
    type: astx.AST
  callee:
    type: ir.Value
  signature:
    type: FunctionSignature
  args:
    type: list[ir.Value]
returns:
  type: ir.Value | None
propagate_status(self, node: astx.AST, status: ir.Value) -> None
title: Route failed generated calls through the active lexical exits.
parameters:
  node:
    type: astx.AST
  status:
    type: ir.Value
abandon_pending_returns(self, completions: tuple[PendingReturn, ...] | None=None, *, preserved_depth: int | None=None) -> None
title: Release only suspended return results replaced by this transfer.
parameters:
  completions:
    type: tuple[PendingReturn, Ellipsis] | None
  preserved_depth:
    type: int | None
abandon_loop_returns(self, target: LoopTargets) -> None
title: A loop transfer replaces only returns outside its local loops.
parameters:
  target:
    type: LoopTargets
propagate_pending_exception(self) -> None
title: Stop ordinary cleanup at the nearest still-active handler.
emit_exception_transfer(self, node: astx.AST | None) -> None
title: Unwind lexical cleanup regions without crossing native frames.
parameters:
  node:
    type: astx.AST | None
emit_success_return(self, value: ir.Value | None) -> None
title: Publish a return value only after every exit region succeeded.
parameters:
  value:
    type: ir.Value | None
emit_entry_wrapper(self) -> None
title: Keep the platform main ABI outside the generated status ABI.
exception_field_address(self, payload: ir.Value, exception: ResolvedExceptionType, *, diagnostic: bool=True) -> ir.Value
title: Address an inherited exception field through its descriptor.
parameters:
  payload:
    type: ir.Value
  exception:
    type: ResolvedExceptionType
  diagnostic:
    type: bool
returns:
  type: ir.Value
initialize_exception_record(self, node: astx.AST, payload: ir.Value, exception: ResolvedExceptionType, *, location: list[ir.Value] | None=None) -> None
title: Snapshot nominal ancestry and message into an opaque record.
parameters:
  node:
    type: astx.AST
  payload:
    type: ir.Value
  exception:
    type: ResolvedExceptionType
  location:
    type: list[ir.Value] | None
fatal_status(self, node: astx.AST, status: ir.Value, *, location: list[ir.Value] | None=None) -> None
title: Fail non-recursively when exception bookkeeping cannot allocate.
parameters:
  node:
    type: astx.AST
  status:
    type: ir.Value
  location:
    type: list[ir.Value] | None
raise_runtime_exception(self, node: astx.AST, role: str, message: ir.Value, *, code: str) -> None
title: Materialize a trusted builtin exception for a native failure.
parameters:
  node:
    type: astx.AST
  role:
    type: str
  message:
    type: ir.Value
  code:
    type: str
builtin_exception_helper(self, node: astx.AST, exception: ResolvedExceptionType) -> ir.Function
title: Share cold builtin materialization between failure guards.
parameters:
  node:
    type: astx.AST
  exception:
    type: ResolvedExceptionType
returns:
  type: ir.Function
materialize_runtime_exception(self, node: astx.AST, exception: ResolvedExceptionType, message: ir.Value, location: list[ir.Value], code: ir.Value) -> ir.Value
title: Create a builtin payload and pending status in a cold helper.
parameters:
  node:
    type: astx.AST
  exception:
    type: ResolvedExceptionType
  message:
    type: ir.Value
  location:
    type: list[ir.Value]
  code:
    type: ir.Value
returns:
  type: ir.Value
visit(self, node: astx.ThrowStmt) -> None
title: Raise one evaluated nominal exception or dynamically re-raise.
parameters:
  node:
    type: astx.ThrowStmt
lower_exception_suite(self, block: astx.Block, *, preserve_scope: bool=False) -> None
title: Lower a statement-only exception suite without leaking values.
parameters:
  block:
    type: astx.Block
  preserve_scope:
    type: bool
visit(self, node: astx.ExceptionHandlerStmt) -> None
title: Lower handlers and finalization as shared lexical exit regions.
parameters:
  node:
    type: astx.ExceptionHandlerStmt
Back to top