Class GuardedAssignmentGenerator
java.lang.Object
org.ek9lang.compiler.phase7.GuardedAssignmentGenerator
- All Implemented Interfaces:
Function<GuardedAssignmentGenerator.GuardedAssignmentDetails,
List<IRInstr>>
final class GuardedAssignmentGenerator
extends Object
implements Function<GuardedAssignmentGenerator.GuardedAssignmentDetails,List<IRInstr>>
Generates IR instructions for guarded assignment operations (:=? - ASSIGN_UNSET).
This generator now uses composition with GUARDED_ASSIGNMENT_BLOCK for declarative, backend-optimizable IR generation. The complex branching logic has been replaced with a high-level block construct that reuses proven QUESTION_BLOCK semantics.
Guarded assignment only assigns to the left-hand side if: 1. LHS is null/uninitialized, OR 2. LHS is not null but _isSet() returns false
The GUARDED_ASSIGNMENT_BLOCK construct uses QUESTION_BLOCK composition internally to ensure consistent null-safety behavior across the EK9 compiler.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Data class to hold parameters for guarded assignment generation. -
Constructor Summary
ConstructorsConstructorDescriptionGuardedAssignmentGenerator
(IRContext context, QuestionBlockGenerator questionBlockGenerator, AssignExpressionToSymbol assignExpressionToSymbol) -
Method Summary
Modifier and TypeMethodDescription
-
Constructor Details
-
GuardedAssignmentGenerator
public GuardedAssignmentGenerator(IRContext context, QuestionBlockGenerator questionBlockGenerator, AssignExpressionToSymbol assignExpressionToSymbol)
-
-
Method Details
-
apply
- Specified by:
apply
in interfaceFunction<GuardedAssignmentGenerator.GuardedAssignmentDetails,
List<IRInstr>>
-