Skip to main content

lower_handler_ir

Function lower_handler_ir 

Source
pub fn lower_handler_ir(
    h: &Handler,
    store_cells: &HashMap<String, TyId>,
    store_queryable: &HashSet<String>,
    state_ty: TyId,
    invariants: &[IrPredicate],
    transitions: &[IrPredicate],
    program: &CheckedProgram,
) -> IrHandler
Expand description

P6.9’s real IrHandler constructor ([DECISION C]/[DECISION D]/ [DECISION E], #1167) — lowers an agent on call handler h into a real IrHandler. store_cells/state_ty/invariants/transitions are parameters, not re-derived ([DECISION E], mirroring lower_invariant_ir’s/lower_transition_ir’s own precedent, P6.8): no persisted “this agent’s store cells / state type” table survives check_agent_decls’s own transient scope, and invariants/transitions are themselves already-lowered IrPredicates a caller must have produced via those same two functions — this function only threads them into lower_commit_shape_ir, never lowers or re-derives them itself. A future IrItem::Agent builder (not commissioned by this slice — see bynk_ir::IrItem’s own doc comment) computes all four once per agent and calls this function once per handler, not re-deriving any of them per call.

Threading real invariants/transitions through (review of #1167, replacing this function’s own original empty-slices posture) matters beyond completeness: an empty pair is structurally indistinguishable from a correct lowering of an agent that genuinely declares neither, so an empty-by-construction commit would have been a silent-wrong-value trap for whatever future caller forgot to populate them for real.

Stays agent-only as of P6.11 (#1171) — lower_service_handler_ir is this function’s own sibling for a service handler, not a widening of it; see that function’s own doc comment for the three reasons the split is deliberate, and this function’s own by_clause.is_none() assert below for the guard widening would have deleted.