Module array_lower

Module array_lower 

Source
Expand description

Pass: HLSL array β†’ WGSL array<T, N> lowering (globals + locals).

FunctionsΒ§

collect_global_array_edits πŸ”’
Walk every top-level Item::GlobalVar with an array length + InitList and emit one text edit per match. Shared between [lower_array_globals] (the standalone pass) and apply_lowerings (the combined pass used by apply_all).
collect_local_array_edits πŸ”’
emit_expr_as_wgsl πŸ”’
Emit an HLSL expression as WGSL text β€” narrow subset, enough for the array-global lowering case where elements are literals or simple arithmetic. Falls back to the raw original text if the expression is outside the supported shape.
span_includes_semi πŸ”’
Extend a span forward to include the trailing ; (if present). The AST’s GlobalVar span ends at the name, not the semicolon β€” for textual replacement we want to swallow the whole declaration.