substRef

fnExpr substRef(Expr e, string name, Expr repl) @safe

Replaces every direct column reference to name with repl, rebuilding the surrounding nodes through the same construction paths a hand-written tree takes (labels included; the replacement is inserted as a closed tree and never re-entered, so references inside repl keep binding to the pre-rewrite frame). Callers guard where substitution is legal; this walk itself is purely structural and never reassociates anything.

Parameters

ethe expression to rewrite
namethe column whose references take the replacement
replthe replacement tree

Returns

the rewritten expression.