Module user_fn

Module user_fn 

Source
Expand description

Pass: user-defined function call-site arg coercion.

FunctionsΒ§

coerce_arg πŸ”’
Emit an edit on arg that converts its inferred type to expected. No-op when both types agree or either is unknown / non-scalar-vec.
coerce_arg_known πŸ”’
Variant that takes the already-known operand type. Use this when an outer pass (binop_vec) has already type-walked the expression and may have emitted truncation edits that change the effective type β€” the stateless infer_type doesn’t see those edits and would over-coerce.
coerce_user_fn_args πŸ”’
Collect every top-level user-defined function in src, then walk every call site to those names and coerce mismatched arg types. MD2 author sloppiness picked up here: passing lavcol(ret*2) where ret*2 is vec3 but lavcol(float t) expects scalar (the EVET preset). HLSL silently truncated; WGSL refuses with InvalidCall.
walk_block_for_user_fn πŸ”’
walk_expr_for_user_fn πŸ”’
walk_stmt_for_user_fn πŸ”’