Skip to main content

lower_service_item_ir

Function lower_service_item_ir 

Source
pub fn lower_service_item_ir(
    service: &ServiceDecl,
    program: &CheckedProgram,
) -> IrItem
Expand description

P6.11 (#1171): assemble a service declaration into a real bynk_ir::IrItem::Service — structural mirror of lower_agent_item_ir, wiring lower_protocol_ir, lower_service_handler_ir and lower_policy_ir rather than re-deriving any of their logic. Unlike the agent case, there is no shared per-declaration context to compute once: a service has no store_cells/state_ty/invariants/transitions (none of those concepts exist for a service at all), so &service.protocol, already on the declaration, is threaded to each handler call directly — the “compute once, reuse” step lower_agent_item_ir’s own doc comment describes degenerates to a borrow here, not because this function skips a step, but because a service’s own handlers have nothing else to share.

No default-by/default-given inheritance logic, deliberately. project_model::inject_service_defaults (bynk-check/src/project_model.rs) already mutated handler.by_clause/handler.given in place at pipeline phase 2b (bynk-check/src/analysis.rs), overriding — not merging — before check_service_decls, let alone this pass, ever runs. h.by_clause/ h.given are already final by the time lower_service_handler_ir sees them; this is stated so a future reader who sees ServiceDecl::default_by/ default_given unread by this function knows that is correct, not an omission.