Class GuardedAssignmentAsmGenerator
java.lang.Object
org.ek9lang.compiler.backend.jvm.AbstractAsmGenerator
org.ek9lang.compiler.backend.jvm.AbstractControlFlowAsmGenerator
org.ek9lang.compiler.backend.jvm.GuardedAssignmentAsmGenerator
Specialized generator for EK9 guarded assignment (:=?).
Handles CONTROL_FLOW_CHAIN with chain_type: "GUARDED_ASSIGNMENT".
EK9 Guarded Assignment Pattern: variable :=? value
- Assigns value to variable only if variable is null or not set
- Prevents overwriting already-initialized variables
- Useful for default value initialization
TODO: Implement after question operator is working and tested. Implementation will follow similar pattern to QuestionOperatorAsmGenerator: - Evaluate condition (variable? returns false if null/unset) - If condition false: execute assignment - If condition true: skip assignment
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractAsmGenerator
AbstractAsmGenerator.LocalVariableInfo, AbstractAsmGenerator.MethodContext, AbstractAsmGenerator.ScopeInfo, AbstractAsmGenerator.TempVariableSource
-
Field Summary
Fields inherited from class AbstractAsmGenerator
classWriter, constructTargetTuple, outputVisitor
-
Constructor Summary
ConstructorsConstructorDescriptionGuardedAssignmentAsmGenerator
(ConstructTargetTuple constructTargetTuple, OutputVisitor outputVisitor, org.objectweb.asm.ClassWriter classWriter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
generate
(ControlFlowChainInstr instr) Generate bytecode for guarded assignment.Methods inherited from class AbstractControlFlowAsmGenerator
branchIfFalse, branchIfTrue, copyResultVariable, createControlFlowLabel, jumpTo, placeLabel, processBodyEvaluation, processConditionCase, processConditionEvaluation
Methods inherited from class AbstractAsmGenerator
convertBooleanToInt, convertToJvmDescriptor, convertToJvmName, generateBooleanLiteral, generateCharacterLiteral, generateDebugInfo, generateFloatLiteral, generateIntegerLiteral, generateLoadVariable, generateLocalVariableTable, generateMethodDescriptor, generateObjectLiteral, generateStackOperation, generateStoreVariable, generateStringLiteral, getCurrentMethodVisitor, getMethodContext, getOrCreateLabel, getVariableIndex, isVariableAllocated, setCurrentMethodVisitor, setSharedMethodContext, trackTempVariableFromLiteral, trackTempVariableFromLoad
-
Constructor Details
-
GuardedAssignmentAsmGenerator
GuardedAssignmentAsmGenerator(ConstructTargetTuple constructTargetTuple, OutputVisitor outputVisitor, org.objectweb.asm.ClassWriter classWriter)
-
-
Method Details
-
generate
Generate bytecode for guarded assignment.- Parameters:
instr
- CONTROL_FLOW_CHAIN instruction with GUARDED_ASSIGNMENT type- Throws:
CompilerException
- Not yet implemented
-