Skip to main content

lower_event_subscriber_shapes_ir

Function lower_event_subscriber_shapes_ir 

Source
pub fn lower_event_subscriber_shapes_ir(
    program: &CheckedProgram,
) -> HashMap<String, EventSubscriberShape>
Expand description

Every from Events(E) service in program’s own unit, captured as an [bynk_ir::EventSubscriberShape] keyed by service name — see that struct’s own doc comment for why this is captured now rather than re-derived cross-unit at compose time (P6.47, #1254).

Slice D0 of #1542 (the IR cutover, design/archive/retired-tracks.md; #1574): reads the two facts it returns from the shape-only helpers that own them — lower_protocol_ir for schema_dispatch, and lower_handler_kind_ir plus lower_service_handler_signature_ir for the Event handler’s parameter count. Before D0 this function went through lower_service_item_ir, which lowers every handler’s body to IrExpr through the expression lowerer and then discards it — the one production route into that lowerer, and the detour §10.2 of the track doc names (the body lowering’s own unreachable!() safety argument covered lower_fn_body_ir’s callers only, never this path). The values are identical by construction: lower_service_handler_ir itself took its params from lower_service_handler_signature_ir and its kind from lower_handler_kind_ir, and lower_service_item_ir its protocol from lower_protocol_ir — this function now calls those three directly and skips the body.

The ServiceProtocol::Events pre-filter stays first: a cheap, structural “which services even have a shape to capture” check (the same match lower_protocol_ir performs), not a raw-AST read of anything the IR side owns.