walk_expr_for_bool_arith

Function walk_expr_for_bool_arith 

Source
fn walk_expr_for_bool_arith(e: &Expr, ctx: &mut WalkCtx<'_>)
Expand description

Walk an expression that lives in arithmetic context (the RHS of a decl/assign, an *= RHS, a */+/-// sub-tree). For every Binary whose operator expects numeric operands, wrap any bool-producing child (comparison or short-circuit) in select(0.0, 1.0, …). Targets a dominant validate-stage failure (InvalidBinaryOperandTypes), exemplified by the MD2 gating idiom value * (rs.z > 0) * (rs.z < hlim).

We don’t try to peek through Member/Swizzle/Index/Call args here — those go through try_wrap_bool_rhs and the call-site coerce pass at function granularity. Conservative wrapping keeps the edits strictly zero-length insertions so existing inner edits (from rewrite_binary_vec_mismatches, etc.) don’t fight us.