Record Class ControlFlowChainDetails
java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.data.ControlFlowChainDetails
public record ControlFlowChainDetails(String result, String chainType, GuardVariableDetails guardDetails, EvaluationVariableDetails evaluationDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DefaultCaseDetails defaultDetails, EnumOptimizationDetails enumOptimizationInfo, DebugInfo debugInfo, String scopeId)
extends Record
Record containing all information needed to create a CONTROL_FLOW_CHAIN 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, guarded assignments, and guard variable patterns.
Used by ControlFlowChainGenerator to coordinate the creation of CONTROL_FLOW_CHAIN instructions with consistent memory management, scope boundaries, and optimization hints.
-
Constructor Summary
ConstructorsConstructorDescriptionControlFlowChainDetails(String result, String chainType, GuardVariableDetails guardDetails, EvaluationVariableDetails evaluationDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DefaultCaseDetails defaultDetails, EnumOptimizationDetails enumOptimizationInfo, DebugInfo debugInfo, String scopeId) Creates an instance of aControlFlowChainDetailsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thechainTyperecord component.Returns the value of theconditionChainrecord component.Get condition scope ID.static ControlFlowChainDetailscreateDoWhileLoop(List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a do-while loop (statement form).static ControlFlowChainDetailscreateForRangeLoop(List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a for-range loop (statement form).static ControlFlowChainDetailscreateIfElse(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for an if/else statement.static ControlFlowChainDetailscreateIfElseWithGuards(String result, List<String> guardVariables, List<IRInstr> guardScopeSetup, String guardScopeId, String conditionScopeId, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for if/else with guard variables.static ControlFlowChainDetailscreateQuestionOperator(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a Question operator (?).static ControlFlowChainDetailscreateSwitch(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a general switch statement.static ControlFlowChainDetailscreateSwitchEnum(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationDetails enumOptimizationInfo, DebugInfo debugInfo, String scopeId) Create details for a switch statement with enum optimization.static ControlFlowChainDetailscreateSwitchWithGuards(String result, List<String> guardVariables, List<IRInstr> guardScopeSetup, String guardScopeId, String conditionScopeId, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for switch with guard variables.static ControlFlowChainDetailscreateWhileLoop(List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a while loop (statement form).Returns the value of thedebugInforecord component.Get default body evaluation instructions.Returns the value of thedefaultDetailsrecord component.Get default result variable.Returns the value of theenumOptimizationInforecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theevaluationDetailsrecord component.Get evaluation variable.Get evaluation variable setup instructions.Get evaluation variable type.Get the scope ID extracted from stack context at Details creation time.Returns the value of theguardDetailsrecord component.Get guard scope ID.Get guard scope setup instructions.Get guard variables list.booleanCheck if this construct has a default case.booleanCheck if this switch has enum optimization information.booleanCheck if this construct has an evaluation variable.booleanCheck if this construct has a guard scope.booleanCheck if this construct uses guard variables.final inthashCode()Returns a hash code value for this object.booleanCheck if this construct has a return variable.booleanCheck if this construct has a shared condition scope.booleanCheck if this is a guard-enabled construct.booleanisIfElse()Check if this is an if/else construct.booleanCheck if this is a Question operator.booleanisSwitch()Check if this is a switch construct.result()Returns the value of theresultrecord component.Returns the value of thereturnDetailsrecord component.Get return variable.Get return variable setup instructions.Get return variable type.scopeId()Returns the value of thescopeIdrecord component.toString()IR-optimized toString following EK9's bracket-only, no-indentation format.
-
Constructor Details
-
ControlFlowChainDetails
public ControlFlowChainDetails(String result, String chainType, GuardVariableDetails guardDetails, EvaluationVariableDetails evaluationDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DefaultCaseDetails defaultDetails, EnumOptimizationDetails enumOptimizationInfo, DebugInfo debugInfo, String scopeId) Creates an instance of aControlFlowChainDetailsrecord class.- Parameters:
result- the value for theresultrecord componentchainType- the value for thechainTyperecord componentguardDetails- the value for theguardDetailsrecord componentevaluationDetails- the value for theevaluationDetailsrecord componentreturnDetails- the value for thereturnDetailsrecord componentconditionChain- the value for theconditionChainrecord componentdefaultDetails- the value for thedefaultDetailsrecord componentenumOptimizationInfo- the value for theenumOptimizationInforecord componentdebugInfo- the value for thedebugInforecord componentscopeId- the value for thescopeIdrecord component
-
-
Method Details
-
createQuestionOperator
public static ControlFlowChainDetails createQuestionOperator(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a Question operator (?). STACK-BASED: scopeId parameter extracted from stack context in generator. -
createIfElse
public static ControlFlowChainDetails createIfElse(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for an if/else statement. STACK-BASED: scopeId parameter extracted from stack context in generator. -
createWhileLoop
public static ControlFlowChainDetails createWhileLoop(List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a while loop (statement form). STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
conditionChain- Single ConditionCaseDetails with loop condition and bodydebugInfo- Debug informationscopeId- Condition scope ID (_scope_2) where temps are registered- Returns:
- ControlFlowChainDetails configured for while loop
-
createDoWhileLoop
public static ControlFlowChainDetails createDoWhileLoop(List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a do-while loop (statement form). STACK-BASED: scopeId parameter extracted from stack context in generator.Key difference from while loop: Body executes FIRST (at least once), then condition is evaluated. Backend generates IFNE (jump if true) instead of IFEQ (jump if false).
- Parameters:
conditionChain- Single ConditionCaseDetails with loop body and conditiondebugInfo- Debug informationscopeId- Whole loop scope ID (_scope_2) for loop control- Returns:
- ControlFlowChainDetails configured for do-while loop
-
createForRangeLoop
public static ControlFlowChainDetails createForRangeLoop(List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a for-range loop (statement form). For-range loops are transformed into while loops with range state setup. STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
conditionChain- Single ConditionCaseDetails with loop condition and bodydebugInfo- Debug informationscopeId- Loop control scope ID (_scope_3) for loop header- Returns:
- ControlFlowChainDetails configured for for-range loop
-
createSwitchEnum
public static ControlFlowChainDetails createSwitchEnum(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, EnumOptimizationDetails enumOptimizationInfo, DebugInfo debugInfo, String scopeId) Create details for a switch statement with enum optimization. STACK-BASED: scopeId parameter extracted from stack context in generator. -
createSwitch
public static ControlFlowChainDetails createSwitch(String result, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a general switch statement. STACK-BASED: scopeId parameter extracted from stack context in generator. -
hasEnumOptimization
public boolean hasEnumOptimization()Check if this switch has enum optimization information. -
getScopeId
Get the scope ID extracted from stack context at Details creation time. STACK-BASED: scopeId comes from IRGenerationContext.currentScopeId() where this object is created. -
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
-
createIfElseWithGuards
public static ControlFlowChainDetails createIfElseWithGuards(String result, List<String> guardVariables, List<IRInstr> guardScopeSetup, String guardScopeId, String conditionScopeId, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for if/else with guard variables. STACK-BASED: scopeId parameter extracted from stack context in generator. -
createSwitchWithGuards
public static ControlFlowChainDetails createSwitchWithGuards(String result, List<String> guardVariables, List<IRInstr> guardScopeSetup, String guardScopeId, String conditionScopeId, String evaluationVariable, String evaluationVariableType, List<IRInstr> evaluationVariableSetup, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for switch with guard variables. STACK-BASED: scopeId parameter extracted from stack context in generator. -
guardVariables
-
guardScopeSetup
-
guardScopeId
Get guard scope ID. -
conditionScopeId
Get condition scope ID. -
evaluationVariable
Get evaluation variable. -
evaluationVariableType
Get evaluation variable type. -
evaluationVariableSetup
-
returnVariable
Get return variable. -
returnVariableType
Get return variable type. -
returnVariableSetup
-
defaultBodyEvaluation
-
defaultResult
Get default result variable. -
hasGuardVariables
public boolean hasGuardVariables()Check if this construct uses guard variables. -
hasGuardScope
public boolean hasGuardScope()Check if this construct has a guard scope. -
hasEvaluationVariable
public boolean hasEvaluationVariable()Check if this construct has an evaluation variable. -
hasReturnVariable
public boolean hasReturnVariable()Check if this construct has a return variable. -
hasDefaultCase
public boolean hasDefaultCase()Check if this construct has a default case. -
isGuardEnabled
public boolean isGuardEnabled()Check if this is a guard-enabled construct. -
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 theresultrecord component.- Returns:
- the value of the
resultrecord component
-
chainType
Returns the value of thechainTyperecord component.- Returns:
- the value of the
chainTyperecord component
-
guardDetails
Returns the value of theguardDetailsrecord component.- Returns:
- the value of the
guardDetailsrecord component
-
evaluationDetails
Returns the value of theevaluationDetailsrecord component.- Returns:
- the value of the
evaluationDetailsrecord component
-
returnDetails
Returns the value of thereturnDetailsrecord component.- Returns:
- the value of the
returnDetailsrecord component
-
conditionChain
Returns the value of theconditionChainrecord component.- Returns:
- the value of the
conditionChainrecord component
-
defaultDetails
Returns the value of thedefaultDetailsrecord component.- Returns:
- the value of the
defaultDetailsrecord component
-
enumOptimizationInfo
Returns the value of theenumOptimizationInforecord component.- Returns:
- the value of the
enumOptimizationInforecord component
-
debugInfo
Returns the value of thedebugInforecord component.- Returns:
- the value of the
debugInforecord component
-
scopeId
Returns the value of thescopeIdrecord component.- Returns:
- the value of the
scopeIdrecord component
-