Class StreamOperandsEvaluatedAhead

java.lang.Object
org.ek9lang.compiler.phase7.generator.StreamOperandsEvaluatedAhead

final class StreamOperandsEvaluatedAhead extends Object
THE record of stream stage function operands that were EVALUATED once, before the pipeline, rather than named - use it, do not re-derive which operands need evaluating.

A stage operand that is a bare identifier names a function (a singleton) or a delegate variable. A call or objectAccessExpression operand - an inline dynamic function (| map with (names) is nameMapper as function (...)), | map with makeMapper(), | filter by holder.predicate() - names neither: it is an expression whose VALUE is the function. It must be evaluated exactly once, before the loop (a dynamic function's captures are taken when it is created, and its state lives across iterations), and every stage then LOADs the resulting variable.

Before this, such operands were never evaluated: the stage asked for a singleton of the function's TYPE, so an inline dynamic function's class was never generated at all (NoClassDefFoundError, QA0059) and a call returning a function reached for an abstract type's missing getInstance().

StreamStatementGenerator records the variables; AbstractStreamStageGenerator reads them wherever a stage fetches its function instance. Keyed by parse-tree identity, so one instance per GeneratorSet serves every stream in the construct.