Record Class SwitchChainDetails
java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.SwitchChainDetails
public record SwitchChainDetails(String result, String chainType, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails)
extends Record
Record containing all information needed to create a SWITCH_CHAIN_BLOCK instruction.
This record aggregates all the necessary data for generating the unified control flow IR, supporting all variants: Question operators, if/else statements, switch statements, and guarded assignments.
Used by SwitchChainBlockGenerator to coordinate the creation of SWITCH_CHAIN_BLOCK instructions with consistent memory management and optimization hints.
-
Constructor Summary
ConstructorsConstructorDescriptionSwitchChainDetails
(String result, String chainType, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails) Creates an instance of aSwitchChainDetails
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebasicDetails
record component.Returns the value of thechainType
record component.Returns the value of theconditionChain
record component.static SwitchChainDetails
createIfElse
(String result, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails) Create details for an if/else statement.static SwitchChainDetails
createQuestionOperator
(String result, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails) Create details for a Question operator (?).static SwitchChainDetails
createSwitch
(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails) Create details for a general switch statement.static SwitchChainDetails
createSwitchEnum
(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails) Create details for a switch statement with enum optimization.Returns the value of thedefaultBodyEvaluation
record component.Returns the value of thedefaultResult
record component.Returns the value of theenumOptimizationInfo
record component.final 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.Get the scope ID from basic details.boolean
Check if this switch has a default case.boolean
Check if this switch has enum optimization information.boolean
Check if this switch has an evaluation variable.final int
hashCode()
Returns a hash code value for this object.boolean
Check if this switch has a return variable.boolean
isIfElse()
Check if this is an if/else construct.boolean
Check if this is a Question operator.boolean
isSwitch()
Check if this is a switch construct.result()
Returns the value of theresult
record component.Returns the value of thereturnVariable
record component.Returns the value of thereturnVariableSetup
record component.Returns the value of thereturnVariableType
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
SwitchChainDetails
public SwitchChainDetails(String result, String chainType, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails) Creates an instance of aSwitchChainDetails
record class.- Parameters:
result
- the value for theresult
record componentchainType
- the value for thechainType
record componentevaluationVariable
- the value for theevaluationVariable
record componentevaluationVariableType
- the value for theevaluationVariableType
record componentevaluationVariableSetup
- the value for theevaluationVariableSetup
record componentreturnVariable
- the value for thereturnVariable
record componentreturnVariableType
- the value for thereturnVariableType
record componentreturnVariableSetup
- the value for thereturnVariableSetup
record componentconditionChain
- the value for theconditionChain
record componentdefaultBodyEvaluation
- the value for thedefaultBodyEvaluation
record componentdefaultResult
- the value for thedefaultResult
record componentenumOptimizationInfo
- the value for theenumOptimizationInfo
record componentbasicDetails
- the value for thebasicDetails
record component
-
-
Method Details
-
createQuestionOperator
public static SwitchChainDetails createQuestionOperator(String result, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails) Create details for a Question operator (?). -
createIfElse
public static SwitchChainDetails createIfElse(String result, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails) Create details for an if/else statement. -
createSwitchEnum
public static SwitchChainDetails createSwitchEnum(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails) Create details for a switch statement with enum optimization. -
createSwitch
public static SwitchChainDetails createSwitch(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails) Create details for a general switch statement. -
hasEvaluationVariable
public boolean hasEvaluationVariable()Check if this switch has an evaluation variable. -
hasReturnVariable
public boolean hasReturnVariable()Check if this switch has a return variable. -
hasDefaultCase
public boolean hasDefaultCase()Check if this switch has a default case. -
hasEnumOptimization
public boolean hasEnumOptimization()Check if this switch has enum optimization information. -
getScopeId
Get the scope ID from basic details. -
isQuestionOperator
public boolean isQuestionOperator()Check if this is a Question operator. -
isIfElse
public boolean isIfElse()Check if this is an if/else construct. -
isSwitch
public boolean isSwitch()Check if this is a switch construct. -
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)
. -
result
Returns the value of theresult
record component.- Returns:
- the value of the
result
record component
-
chainType
Returns the value of thechainType
record component.- Returns:
- the value of the
chainType
record component
-
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
-
returnVariable
Returns the value of thereturnVariable
record component.- Returns:
- the value of the
returnVariable
record component
-
returnVariableType
Returns the value of thereturnVariableType
record component.- Returns:
- the value of the
returnVariableType
record component
-
returnVariableSetup
-
conditionChain
Returns the value of theconditionChain
record component.- Returns:
- the value of the
conditionChain
record component
-
defaultBodyEvaluation
-
defaultResult
Returns the value of thedefaultResult
record component.- Returns:
- the value of the
defaultResult
record component
-
enumOptimizationInfo
Returns the value of theenumOptimizationInfo
record component.- Returns:
- the value of the
enumOptimizationInfo
record component
-
basicDetails
Returns the value of thebasicDetails
record component.- Returns:
- the value of the
basicDetails
record component
-