Record Class EvaluationVariableDetails
java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.EvaluationVariableDetails
public record EvaluationVariableDetails(String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup)
extends Record
Record containing evaluation variable management information for CONTROL_FLOW_CHAIN constructs.
Evaluation variables are used in switch statements where the switch expression is computed and stored in a variable for comparison against case conditions: - switch statements: "switch someVar" or "switch var := expr" - switch expressions: "result <- switch someVar"
For if/else statements and Question operators, evaluation variables are not used since conditions are evaluated directly as boolean expressions.
-
Constructor Summary
ConstructorsConstructorDescriptionEvaluationVariableDetails
(String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup) Creates an instance of aEvaluationVariableDetails
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.Returns the value of theevaluationVariable
record component.Returns the value of theevaluationVariableSetup
record component.Returns the value of theevaluationVariableType
record component.static EvaluationVariableDetails
forVariable
(String evaluationVariable, String evaluationVariableType) Create evaluation variable details for existing variable.boolean
Check if this has an evaluation variable.final int
hashCode()
Returns a hash code value for this object.boolean
Check if this has setup instructions.boolean
isEmpty()
Check if this evaluation details object is empty (no evaluation variable).static EvaluationVariableDetails
none()
Create empty evaluation variable details (no evaluation variable).toString()
IR-optimized toString following EK9's bracket-only, no-indentation format.static EvaluationVariableDetails
withSetup
(String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup) Create evaluation variable details with setup instructions.
-
Constructor Details
-
EvaluationVariableDetails
public EvaluationVariableDetails(String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup) Creates an instance of aEvaluationVariableDetails
record class.- Parameters:
evaluationVariable
- the value for theevaluationVariable
record componentevaluationVariableType
- the value for theevaluationVariableType
record componentevaluationVariableSetup
- the value for theevaluationVariableSetup
record component
-
-
Method Details
-
none
Create empty evaluation variable details (no evaluation variable). -
forVariable
public static EvaluationVariableDetails forVariable(String evaluationVariable, String evaluationVariableType) Create evaluation variable details for existing variable. -
withSetup
public static EvaluationVariableDetails withSetup(String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup) Create evaluation variable details with setup instructions. -
hasEvaluationVariable
public boolean hasEvaluationVariable()Check if this has an evaluation variable. -
hasSetupInstructions
public boolean hasSetupInstructions()Check if this has setup instructions. -
isEmpty
public boolean isEmpty()Check if this evaluation details object is empty (no evaluation variable). -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
evaluationVariable
Returns the value of theevaluationVariable
record component.- Returns:
- the value of the
evaluationVariable
record component
-
evaluationVariableType
Returns the value of theevaluationVariableType
record component.- Returns:
- the value of the
evaluationVariableType
record component
-
evaluationVariableSetup
-