pub fn lower_agent_item_ir(
agent: &AgentDecl,
program: &CheckedProgram,
) -> IrItemExpand description
P6.10 (#1169): assemble an agent declaration into a real
bynk_ir::IrItem::Agent — wires every prior slice’s own standalone
constructor (lower_store_field_ir since P6.7, lower_invariant_ir/
lower_transition_ir/lower_commit_shape_ir since P6.8,
lower_handler_ir since P6.9) rather than re-deriving any of their
logic — the first IrItem variant assembled from other already-real IR
data rather than lowered fresh from the AST by itself.
Computes state/store_cells/state_ty once and reuses them for every
downstream call that needs them — the “future IrItem::Agent builder”
every one of those constructors’ own doc comments already named as the
job that would do this. store_cells is derived from state’s own
already-lowered StoreKindIr::Cell entries, not re-resolved
independently a second time from the AST — the one place this function
could have re-derived something it already has, and doesn’t.
invariants/transitions are lowered once, then passed to every
handler’s own lower_handler_ir call, not just the store-writing
ones: lower_commit_shape_ir only ever reads them for a
Transactional shape, so a read-only or event-flushing handler simply
carries the slices it was handed without using them, the same “pass
what a callee needs, let it decide whether to use it” posture
lower_commit_shape_ir’s own emits parameter already established.