inject_broadcasts

Function inject_broadcasts 

Source
pub fn inject_broadcasts(src: &str, table: &SymbolTable) -> String
Expand description

Walk src looking for calls to broadcast-prone builtins; rewrite scalar arguments to vec constructors where the dominant arg is a vec.

Recursion strategy: for every matched call, we first recursively apply the broadcast rewrite to each argument, then decide whether to broadcast at the current level. This ensures that pow(clamp(<vec>, 0, 1), 0.5) both rewrites the inner clamp and the outer pow in a single sweep, instead of needing a fixed-point loop with the walker skipping past unrewritten inner calls.