Class OperandWalker
Operand expression trees (and
the Predicate trees that contain them).
Several analyses each used to carry a near-identical switch that
recursed the compound operands and differed only in their terminal action —
the semantic validator's constant-argument / projected-operand / column-existence
checks, and the processor's COVER factor-dependency collector. Centralising the
recursion here gives every Operand/Predicate subtype a
single registration point: when a new operand kind is added, only this
walker needs the extra arm, and no caller can silently drop references inside it.
The walk recurses into every compound operand
(BinaryArithmeticExpression, UnaryOperand,
SetLiteralOperand, StructConstruction, ArrayConstruction,
and a FunctionCall's arguments) and invokes:
onAttributefor eachAttributeOperand, andonFunctionfor eachFunctionCall(the call's arguments are still walked).
This module carries no dependencies beyond the JDK, so the walker is safe to reuse from any module that depends on the AST.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidwalk(Operand expr, Consumer<AttributeOperand> onAttribute, Consumer<FunctionCall> onFunction) Walksexpr, invokingonAttributefor each attribute reference andonFunctionfor each function call.static voidwalk(Predicate predicate, Consumer<AttributeOperand> onAttribute, Consumer<FunctionCall> onFunction) Walks everyOperandreachable throughpredicate, recursing the predicate's logical structure and drivingwalk(Operand, Consumer, Consumer)at each leaf operand.
-
Method Details
-
walk
public static void walk(Operand expr, Consumer<AttributeOperand> onAttribute, Consumer<FunctionCall> onFunction) Walksexpr, invokingonAttributefor each attribute reference andonFunctionfor each function call. A function call's arguments are walked beforeonFunctionfires, matching the argument-then-callee error ordering callers rely on. -
walk
public static void walk(Predicate predicate, Consumer<AttributeOperand> onAttribute, Consumer<FunctionCall> onFunction) Walks everyOperandreachable throughpredicate, recursing the predicate's logical structure and drivingwalk(Operand, Consumer, Consumer)at each leaf operand. The callbacks fire with the same contract as the operand overload.
-