Class QuestionBlockGenerator
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.QuestionBlockGenerator
- All Implemented Interfaces:
Function<ExprProcessingDetails, List<IRInstr>>
public final class QuestionBlockGenerator
extends AbstractGenerator
implements Function<ExprProcessingDetails, List<IRInstr>>
Generates IR instructions for question operator (?) using unified SWITCH_CHAIN_BLOCK.
This generator has been migrated to use the unified control flow approach:
1. Delegates to injected ControlFlowChainGenerator for actual IR generation
2. Maintains backward compatibility with existing call sites
3. Uses CONTROL_FLOW_CHAIN with QUESTION_OPERATOR chain type
The Question operator becomes a simple two-case CONTROL_FLOW_CHAIN:
- Case 1: if (operand == null) return Boolean(false)
- Default: else return operand._isSet()
PHASE 7 REFACTORING COMPLETE: Now accepts injected ControlFlowChainGenerator for maximum object reuse.
-
Field Summary
Fields inherited from class AbstractGenerator
debugInfoCreator, instructionBuilder, stackContext -
Constructor Summary
ConstructorsConstructorDescriptionQuestionBlockGenerator(IRGenerationContext stackContext, ControlFlowChainGenerator controlFlowChainGenerator) -
Method Summary
Methods inherited from class AbstractGenerator
createTempVariable, createTempVariableFromContext, extractReturnType, getRecordedSymbolOrException
-
Constructor Details
-
QuestionBlockGenerator
public QuestionBlockGenerator(IRGenerationContext stackContext, ControlFlowChainGenerator controlFlowChainGenerator)
-
-
Method Details
-
apply
- Specified by:
applyin interfaceFunction<ExprProcessingDetails, List<IRInstr>>
-