Class StreamStatementGenerator
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.AbstractStreamStageGenerator
org.ek9lang.compiler.phase7.generator.StreamStatementGenerator
- All Implemented Interfaces:
Function<EK9Parser.StreamStatementContext, List<IRInstr>>
public final class StreamStatementGenerator
extends AbstractStreamStageGenerator
implements Function<EK9Parser.StreamStatementContext, List<IRInstr>>
Generates IR for stream statement pipelines: source | stages | > terminal.
Handles the statement form of stream pipelines where items flow from a source (cat or for) through zero or more pipeline stages to a terminal sink.
For cat sources, follows the same 4-scope structure as ForInGenerator:
- Outer scope (source evaluation + iterator + terminal setup)
- Pipeline scope (pipeline item variable)
- Condition scope (hasNext check, per-iteration)
- Body scope (next + stages + terminal pipe, per-iteration)
For for sources, uses RangeIterationHelper to generate
ForRangePolymorphicInstr where the body is _pipe(loopVar) to the terminal,
reusing the same polymorphic range iteration as for-range loops.
-
Field Summary
Fields inherited from class AbstractStreamStageGenerator
generators, listBufferCalls, symbolTypeOrException, valuePromoterFields inherited from class AbstractGenerator
constantCopyOnAccessLoader, debugInfoCreator, instructionBuilder, MAX_MESSAGE_LENGTH, stackContext, synthesisedCallMetaData, typeNameOrException -
Constructor Summary
ConstructorsConstructorDescriptionStreamStatementGenerator(IRGenerationContext stackContext, GeneratorSet generators) -
Method Summary
Modifier and TypeMethodDescriptionapplyExpression(EK9Parser.StreamExpressionContext ctx, String rhsExprResult) Generate IR for stream expression form:result <- cat items | stages | collect as Type.Methods inherited from class AbstractStreamStageGenerator
addManagedCall, concrete, emitStageFunctionOperand, evaluateExpressionOperand, extractPrimitive, gate, generateCounterDelta, generateTerminalPipe, publishAndContinue, rebind, streamFunctionCallMethods inherited from class AbstractGenerator
addCoverageProbe, createTempVariable, createTempVariableFromContext, extractReturnType, getRecordedSymbolOrException, processBlockStatements, processBlockStatements, truncateMessage, truncateMessage
-
Constructor Details
-
StreamStatementGenerator
StreamStatementGenerator(IRGenerationContext stackContext, GeneratorSet generators)
-
-
Method Details
-
apply
- Specified by:
applyin interfaceFunction<EK9Parser.StreamStatementContext, List<IRInstr>>
-
applyExpression
Generate IR for stream expression form:result <- cat items | stages | collect as Type.Pattern:
- Construct collector instance via default constructor
- Run pipeline with collector as terminal (same as statement form)
- Transfer ownership of collector to rhsExprResult
- Parameters:
ctx- The stream expression contextrhsExprResult- The assignment target variable for the collected result- Returns:
- IR instructions for the complete stream expression
-