Record Class ControlFlowChainDetails

java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.ControlFlowChainDetails

public record ControlFlowChainDetails(String result, String chainType, GuardVariableDetails guardDetails, EvaluationVariableDetails evaluationDetails, ReturnVariableDetails returnDetails, List<ConditionCase> conditionChain, DefaultCaseDetails defaultDetails, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails) 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 Details

    • ControlFlowChainDetails

      public ControlFlowChainDetails(String result, String chainType, GuardVariableDetails guardDetails, EvaluationVariableDetails evaluationDetails, ReturnVariableDetails returnDetails, List<ConditionCase> conditionChain, DefaultCaseDetails defaultDetails, EnumOptimizationInfo enumOptimizationInfo, BasicDetails basicDetails)
      Creates an instance of a ControlFlowChainDetails record class.
      Parameters:
      result - the value for the result record component
      chainType - the value for the chainType record component
      guardDetails - the value for the guardDetails record component
      evaluationDetails - the value for the evaluationDetails record component
      returnDetails - the value for the returnDetails record component
      conditionChain - the value for the conditionChain record component
      defaultDetails - the value for the defaultDetails record component
      enumOptimizationInfo - the value for the enumOptimizationInfo record component
      basicDetails - the value for the basicDetails record component
  • Method Details

    • createQuestionOperator

      public static ControlFlowChainDetails createQuestionOperator(String result, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails)
      Create details for a Question operator (?).
    • createIfElse

      public static ControlFlowChainDetails createIfElse(String result, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails)
      Create details for an if/else statement.
    • createSwitchEnum

      public static ControlFlowChainDetails 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 ControlFlowChainDetails 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.
    • hasEnumOptimization

      public boolean hasEnumOptimization()
      Check if this switch has enum optimization information.
    • getScopeId

      public String 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

      @Nonnull public String toString()
      IR-optimized toString following EK9's bracket-only, no-indentation format. Uses StringBuilder for performance and delegates to Details records for their sections.
      Specified by:
      toString in class Record
    • createIfElseWithGuards

      public static ControlFlowChainDetails createIfElseWithGuards(String result, List<String> guardVariables, List<IRInstr> guardScopeSetup, String guardScopeId, String conditionScopeId, List<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails)
      Create details for if/else with guard variables.
    • 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<ConditionCase> conditionChain, List<IRInstr> defaultBodyEvaluation, String defaultResult, BasicDetails basicDetails)
      Create details for switch with guard variables.
    • guardVariables

      public List<String> guardVariables()
      Get guard variables list.
    • guardScopeSetup

      public List<IRInstr> guardScopeSetup()
      Get guard scope setup instructions.
    • guardScopeId

      public String guardScopeId()
      Get guard scope ID.
    • conditionScopeId

      public String conditionScopeId()
      Get condition scope ID.
    • evaluationVariable

      public String evaluationVariable()
      Get evaluation variable.
    • evaluationVariableType

      public String evaluationVariableType()
      Get evaluation variable type.
    • evaluationVariableSetup

      public List<IRInstr> evaluationVariableSetup()
      Get evaluation variable setup instructions.
    • returnVariable

      public String returnVariable()
      Get return variable.
    • returnVariableType

      public String returnVariableType()
      Get return variable type.
    • returnVariableSetup

      public List<IRInstr> returnVariableSetup()
      Get return variable setup instructions.
    • defaultBodyEvaluation

      public List<IRInstr> defaultBodyEvaluation()
      Get default body evaluation instructions.
    • defaultResult

      public String 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.
    • hasSharedConditionScope

      public boolean hasSharedConditionScope()
      Check if this construct has a shared condition 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

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • result

      public String result()
      Returns the value of the result record component.
      Returns:
      the value of the result record component
    • chainType

      public String chainType()
      Returns the value of the chainType record component.
      Returns:
      the value of the chainType record component
    • guardDetails

      public GuardVariableDetails guardDetails()
      Returns the value of the guardDetails record component.
      Returns:
      the value of the guardDetails record component
    • evaluationDetails

      public EvaluationVariableDetails evaluationDetails()
      Returns the value of the evaluationDetails record component.
      Returns:
      the value of the evaluationDetails record component
    • returnDetails

      public ReturnVariableDetails returnDetails()
      Returns the value of the returnDetails record component.
      Returns:
      the value of the returnDetails record component
    • conditionChain

      public List<ConditionCase> conditionChain()
      Returns the value of the conditionChain record component.
      Returns:
      the value of the conditionChain record component
    • defaultDetails

      public DefaultCaseDetails defaultDetails()
      Returns the value of the defaultDetails record component.
      Returns:
      the value of the defaultDetails record component
    • enumOptimizationInfo

      public EnumOptimizationInfo enumOptimizationInfo()
      Returns the value of the enumOptimizationInfo record component.
      Returns:
      the value of the enumOptimizationInfo record component
    • basicDetails

      public BasicDetails basicDetails()
      Returns the value of the basicDetails record component.
      Returns:
      the value of the basicDetails record component