Record Class ControlFlowChainDetails
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, guard variable patterns, and try/catch/finally exception handling.
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, TryBlockDetails tryBlockDetails, List<IRInstr> finallyBlockEvaluation, 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 ControlFlowChainDetailscreateComparisonCoalescing(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId, String chainType) Create details for comparison coalescing operators (<?, >?, <=?, >=?).static ControlFlowChainDetailscreateDoWhileExpression(String result, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a do-while expression (result <- do { body } while condition).static ControlFlowChainDetailscreateDoWhileLoopUnified(GuardVariableDetails guardDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Unified factory for do-while loops - automatically selects expression or statement form.static ControlFlowChainDetailscreateDoWhileLoopWithGuards(GuardVariableDetails guardDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a do-while loop with guard variables (statement form).static ControlFlowChainDetailscreateElvisCoalescing(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for an Elvis Coalescing operator (:?).static ControlFlowChainDetailscreateForInExpression(String result, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a for-in expression (result <- for item in collection).static ControlFlowChainDetailscreateForRangeExpression(String result, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a for-range expression (result <- for i in start ..< end).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, GuardVariableDetails guardDetails, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for an if/else statement with guard variables.static ControlFlowChainDetailscreateNullCoalescing(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a Null Coalescing operator (??).static ControlFlowChainDetailscreateQuestionOperator(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a Question operator (?).static ControlFlowChainDetailscreateSwitchExpression(String result, EvaluationVariableDetails evaluationDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a switch expression (result <- switch expr).static ControlFlowChainDetailscreateSwitchWithGuards(String result, GuardVariableDetails guardDetails, String evaluationVariable, String evaluationVariableType, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a switch statement with guard variable support.static ControlFlowChainDetailscreateTernaryOperator(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a Ternary operator (condition <- thenValue : elseValue).static ControlFlowChainDetailscreateTryCatchExpression(String result, ReturnVariableDetails returnDetails, TryBlockDetails tryBlockDetails, List<ConditionCaseDetails> catchHandlers, List<IRInstr> finallyBlockEvaluation, DebugInfo debugInfo, String scopeId) Create details for a try-catch expression (result <- try { expr } catch { handler }).static ControlFlowChainDetailscreateTryCatchFinally(String result, GuardVariableDetails guardDetails, ReturnVariableDetails returnDetails, TryBlockDetails tryBlockDetails, List<ConditionCaseDetails> catchHandlers, List<IRInstr> finallyBlockEvaluation, DebugInfo debugInfo, String scopeId) Create details for a try/catch/finally construct.static ControlFlowChainDetailscreateWhileExpression(String result, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a while expression (result <- while condition).static ControlFlowChainDetailscreateWhileLoop(List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a while loop (statement form).static ControlFlowChainDetailscreateWhileLoopUnified(GuardVariableDetails guardDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Unified factory for while loops - automatically selects expression or statement form.static ControlFlowChainDetailscreateWhileLoopWithGuards(GuardVariableDetails guardDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a while loop with guard variables (statement form).Returns the value of thedebugInforecord component.Get default body evaluation instructions.Returns the value of thedefaultDetailsrecord component.Get default result variable.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.Returns the value of thefinallyBlockEvaluationrecord component.Get the scope ID extracted from stack context at Details creation time.Returns the value of theguardDetailsrecord component.Get guard entry check instructions (for WHILE/DO-WHILE loops).Get guard entry check primitive variable name (for WHILE/DO-WHILE loops).Get guard scope ID.Get guard scope setup instructions.Get guard variables list.booleanCheck if this construct has a default case.booleanCheck if this construct has a guard entry check (for WHILE/DO-WHILE loops).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 shared condition scope.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.Returns the value of thetryBlockDetailsrecord component.Get try body evaluation instructions.Get try body result variable.Get try scope ID.
-
Constructor Details
-
ControlFlowChainDetails
public ControlFlowChainDetails(String result, String chainType, GuardVariableDetails guardDetails, EvaluationVariableDetails evaluationDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DefaultCaseDetails defaultDetails, TryBlockDetails tryBlockDetails, List<IRInstr> finallyBlockEvaluation, 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 componenttryBlockDetails- the value for thetryBlockDetailsrecord componentfinallyBlockEvaluation- the value for thefinallyBlockEvaluationrecord 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. -
createNullCoalescing
public static ControlFlowChainDetails createNullCoalescing(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a Null Coalescing operator (??). STACK-BASED: scopeId parameter extracted from stack context in generator. -
createElvisCoalescing
public static ControlFlowChainDetails createElvisCoalescing(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for an Elvis Coalescing operator (:?). Returns LHS if both memory allocated AND set, otherwise evaluates and returns RHS. STACK-BASED: scopeId parameter extracted from stack context in generator. -
createComparisonCoalescing
public static ControlFlowChainDetails createComparisonCoalescing(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId, String chainType) Create details for comparison coalescing operators (<?, >?, <=?, >=?). Returns LHS if both operands valid and comparison true, else gracefully handles null/unset. STACK-BASED: scopeId parameter extracted from stack context in generator. -
createTernaryOperator
public static ControlFlowChainDetails createTernaryOperator(String result, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a Ternary operator (condition <- thenValue : elseValue). Returns thenValue if condition is true, else returns elseValue. 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. -
createIfElseWithGuards
public static ControlFlowChainDetails createIfElseWithGuards(String result, GuardVariableDetails guardDetails, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for an if/else statement with guard variables. 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
-
createWhileLoopWithGuards
public static ControlFlowChainDetails createWhileLoopWithGuards(GuardVariableDetails guardDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a while loop with guard variables (statement form). STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
guardDetails- Guard variable details (guard <- expr())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 with guards
-
createDoWhileLoopWithGuards
public static ControlFlowChainDetails createDoWhileLoopWithGuards(GuardVariableDetails guardDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a do-while loop with guard variables (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:
guardDetails- Guard variable details (do guard <- expr() { body } while condition)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 with guards
-
createSwitchWithGuards
public static ControlFlowChainDetails createSwitchWithGuards(String result, GuardVariableDetails guardDetails, String evaluationVariable, String evaluationVariableType, String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a switch statement with guard variable support. STACK-BASED: scopeId parameter extracted from stack context in generator.Uses guard details to determine chain type: - SWITCH_WITH_GUARDS when guards are present - SWITCH when no guards present
-
createTryCatchFinally
public static ControlFlowChainDetails createTryCatchFinally(String result, GuardVariableDetails guardDetails, ReturnVariableDetails returnDetails, TryBlockDetails tryBlockDetails, List<ConditionCaseDetails> catchHandlers, List<IRInstr> finallyBlockEvaluation, DebugInfo debugInfo, String scopeId) Create details for a try/catch/finally construct. STACK-BASED: scopeId parameter extracted from stack context in generator.Try/catch/finally uses CONTROL_FLOW_CHAIN with exception handlers as condition cases. Each catch block is represented as a ConditionCaseDetails with EXCEPTION_HANDLER type. The finally block (if present) executes after try/catch completion.
- Parameters:
result- Result variable for expression forms (null for statement forms)guardDetails- Guard variable details for pre-flow (try var <- getValue())returnDetails- Return variable details for expression formstryBlockDetails- Try block scope and body evaluationcatchHandlers- List of catch handlers (each is a ConditionCaseDetails with EXCEPTION_HANDLER type)finallyBlockEvaluation- Finally block instructions (empty if no finally)debugInfo- Debug informationscopeId- Outer scope ID for the entire try/catch/finally construct- Returns:
- ControlFlowChainDetails configured for try/catch/finally
-
createSwitchExpression
public static ControlFlowChainDetails createSwitchExpression(String result, EvaluationVariableDetails evaluationDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, DebugInfo debugInfo, String scopeId) Create details for a switch expression (result <- switch expr).Expression forms return a value via the return variable declared in returningParam. Guards are NOT supported in expression forms (enforced by semantic analysis).
STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
result- The overall result variable for the control flowevaluationDetails- Evaluation variable details for the switch expressionreturnDetails- Return variable details from returningParam processingconditionChain- List of case conditions with their bodiesdefaultBodyEvaluation- Default case body instructionsdefaultResult- Default case result variabledebugInfo- Debug informationscopeId- Scope ID from stack context- Returns:
- ControlFlowChainDetails configured for switch expression
-
createForRangeExpression
public static ControlFlowChainDetails createForRangeExpression(String result, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a for-range expression (result <- for i in start ..< end).Expression forms return a value via the return variable declared in returningParam. Guards are NOT supported in expression forms (enforced by semantic analysis). The loop accumulates results into the return variable.
STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
result- The overall result variable for the control flowreturnDetails- Return variable details from returningParam processingconditionChain- Loop condition with body (single element)debugInfo- Debug informationscopeId- Scope ID from stack context- Returns:
- ControlFlowChainDetails configured for for-range expression
-
createForInExpression
public static ControlFlowChainDetails createForInExpression(String result, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a for-in expression (result <- for item in collection).Expression forms return a value via the return variable declared in returningParam. Guards are NOT supported in expression forms (enforced by semantic analysis). The loop accumulates results into the return variable.
STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
result- The overall result variable for the control flowreturnDetails- Return variable details from returningParam processingconditionChain- Loop condition with body (single element)debugInfo- Debug informationscopeId- Scope ID from stack context- Returns:
- ControlFlowChainDetails configured for for-in expression
-
createWhileExpression
public static ControlFlowChainDetails createWhileExpression(String result, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a while expression (result <- while condition).Expression forms return a value via the return variable declared in returningParam. Guards are NOT supported in expression forms (enforced by semantic analysis).
STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
result- The overall result variable for the control flowreturnDetails- Return variable details from returningParam processingconditionChain- Loop condition with body (single element)debugInfo- Debug informationscopeId- Scope ID from stack context- Returns:
- ControlFlowChainDetails configured for while expression
-
createDoWhileExpression
public static ControlFlowChainDetails createDoWhileExpression(String result, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Create details for a do-while expression (result <- do { body } while condition).Expression forms return a value via the return variable declared in returningParam. Guards are NOT supported in expression forms (enforced by semantic analysis). Body executes at least once before condition is checked.
STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
result- The overall result variable for the control flowreturnDetails- Return variable details from returningParam processingconditionChain- Loop body with condition (single element)debugInfo- Debug informationscopeId- Scope ID from stack context- Returns:
- ControlFlowChainDetails configured for do-while expression
-
createTryCatchExpression
public static ControlFlowChainDetails createTryCatchExpression(String result, ReturnVariableDetails returnDetails, TryBlockDetails tryBlockDetails, List<ConditionCaseDetails> catchHandlers, List<IRInstr> finallyBlockEvaluation, DebugInfo debugInfo, String scopeId) Create details for a try-catch expression (result <- try { expr } catch { handler }).Expression forms return a value via the return variable declared in returningParam. Guards are NOT supported in expression forms (enforced by semantic analysis).
STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
result- The overall result variable for the control flowreturnDetails- Return variable details from returningParam processingtryBlockDetails- Try block scope and body evaluationcatchHandlers- List of catch handlers as condition casesfinallyBlockEvaluation- Finally block instructions (empty if no finally)debugInfo- Debug informationscopeId- Scope ID from stack context- Returns:
- ControlFlowChainDetails configured for try-catch expression
-
createWhileLoopUnified
public static ControlFlowChainDetails createWhileLoopUnified(GuardVariableDetails guardDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Unified factory for while loops - automatically selects expression or statement form.Selection priority: 1. Expression form if returnDetails has return variable 2. Statement form with guards if guardDetails has guards 3. Plain statement form otherwise
STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
guardDetails- Guard variable details (may be empty)returnDetails- Return variable details (may be empty)conditionChain- Single ConditionCaseDetails with loop condition and bodydebugInfo- Debug informationscopeId- Scope ID from stack context- Returns:
- ControlFlowChainDetails configured for appropriate while form
-
createDoWhileLoopUnified
public static ControlFlowChainDetails createDoWhileLoopUnified(GuardVariableDetails guardDetails, ReturnVariableDetails returnDetails, List<ConditionCaseDetails> conditionChain, DebugInfo debugInfo, String scopeId) Unified factory for do-while loops - automatically selects expression or statement form.Selection priority: 1. Expression form if returnDetails has return variable 2. Statement form with guards if guardDetails has guards 3. Plain statement form otherwise
STACK-BASED: scopeId parameter extracted from stack context in generator.- Parameters:
guardDetails- Guard variable details (may be empty)returnDetails- Return variable details (may be empty)conditionChain- Single ConditionCaseDetails with loop body and conditiondebugInfo- Debug informationscopeId- Scope ID from stack context- Returns:
- ControlFlowChainDetails configured for appropriate do-while form
-
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. -
toString
-
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. -
hasGuardEntryCheck
public boolean hasGuardEntryCheck()Check if this construct has a guard entry check (for WHILE/DO-WHILE loops). -
guardEntryCheck
-
guardEntryCheckPrimitive
Get guard entry check primitive variable name (for WHILE/DO-WHILE loops). -
hasDefaultCase
public boolean hasDefaultCase()Check if this construct has a default case. -
tryScopeId
Get try scope ID. -
tryBodyEvaluation
-
tryBodyResult
Get try body result variable. -
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
-
tryBlockDetails
Returns the value of thetryBlockDetailsrecord component.- Returns:
- the value of the
tryBlockDetailsrecord component
-
finallyBlockEvaluation
-
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
-