Skip to main content

match_needs_if_chain

Function match_needs_if_chain 

Source
pub fn match_needs_if_chain(arms: &[MatchArm]) -> bool
Expand description

A match needs the if/else-if lowering (ADR 0169) when any arm carries a guard or a refutable nested payload pattern — a JS switch on .tag can express neither. Flat, unguarded matches keep the switch (zero churn to existing output).

Consumed only by bynk-emit’s string emitter today (emitter/lower.rs’s two match-lowering sites). It became pub and moved here at P6.5/P7.12 so the IR lowering pass could reuse the identical predicate to record its own match form and the two could never silently disagree; that second consumer went with Slices D1/D2 of #1542. It stays in bynk-ir rather than moving back because it is a pure predicate over the AST with no emitter state, the same footing as its three sibling walk helpers above, and moving it would be churn with no reader gained.