pub fn node_is_statement(node: &AIRNode) -> boolExpand description
Returns true if node is a statement-like AIR node — one that performs
control flow or mutation and yields no usable value in expression position.
These are exactly the node kinds a target’s expression form (ternary, IIFE,
value-match arm) cannot host: break, continue, return, assignment,
and an if that yields no value.
An if is statement-like — and so must be emitted in statement position
rather than lowered to a ternary / IIFE — exactly when it produces no value:
- it has no
elsebranch (a value-lessifcannot be an expression), or - it has an
elsebranch but both branches are statement bodies (e.g.if (c) { return a } else { return b }), so neither yields a value.
A value if/else (e.g. let x = if (c) { 1 } else { 2 }) always has an
else whose branches end in an expression tail, so
arm_body_is_statement returns false for them and the if stays an
expression. if let … = expr returning a value is likewise unaffected: with
an expression-tail else it is not classified here.