Value
SpecialValue module-attribute
SpecialValue: TypeAlias = (
None
| ReturnValue[ValueType]
| YieldValue[ValueType]
| Successor[ValueType]
)
Special value for statement evaluation.
StatementResult module-attribute
StatementResult: TypeAlias = (
tuple[ValueType, ...] | SpecialValue[ValueType]
)
Type alias for the result of a statement evaluation.
ReturnValue dataclass
ReturnValue(value: ValueType)
Bases: Generic[ValueType]
Return value from a statement evaluation.
This class represents a return value from a statement evaluation. It is used to indicate that the statement evaluation should later pop the frame and return the value. Kirin does not allow multiple return values to follow Python semantics. If you want to return multiple values, you should return a tuple.
Successor dataclass
Successor(block: Block, *block_args: ValueType)
Bases: Generic[ValueType]
Successor block from a statement evaluation.
Source code in src/kirin/interp/value.py
56 57 58 59 |
|
YieldValue dataclass
YieldValue(values: tuple[ValueType, ...])
Bases: Generic[ValueType]
Yield value from a statement evaluation.
This class represents values returned from a statement that terminates current region execution and returns the values to the caller. Unlike ReturnValue
, this class won't pop the frame and return the value to the caller.