Record Class ReturnVariableDetails
java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.data.ReturnVariableDetails
public record ReturnVariableDetails(String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup)
extends Record
Record containing return variable management information for CONTROL_FLOW_CHAIN constructs.
Return variables are used in expression forms of control flow constructs where the result of the construct is assigned to a declared variable: - switch expressions: "result <- switch someVar" - if expressions: "result <- if condition then value1 else value2"
For statement forms (if statements, switch statements), return variables are not used since the construct doesn't produce a result value.
-
Constructor Summary
ConstructorsConstructorDescriptionReturnVariableDetails(String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup) Creates an instance of aReturnVariableDetailsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static ReturnVariableDetailsforVariable(String returnVariable, String returnVariableType) Create return variable details for existing variable.final inthashCode()Returns a hash code value for this object.booleanCheck if this has a return variable.booleanCheck if this has setup instructions.booleanisEmpty()Check if this return details object is empty (no return variable).static ReturnVariableDetailsnone()Create empty return variable details (no return variable).Returns the value of thereturnVariablerecord component.Returns the value of thereturnVariableSetuprecord component.Returns the value of thereturnVariableTyperecord component.toString()IR-optimized toString following EK9's bracket-only, no-indentation format.static ReturnVariableDetailsCreate return variable details with setup instructions.
-
Constructor Details
-
ReturnVariableDetails
public ReturnVariableDetails(String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup) Creates an instance of aReturnVariableDetailsrecord class.- Parameters:
returnVariable- the value for thereturnVariablerecord componentreturnVariableType- the value for thereturnVariableTyperecord componentreturnVariableSetup- the value for thereturnVariableSetuprecord component
-
-
Method Details
-
none
Create empty return variable details (no return variable). -
forVariable
Create return variable details for existing variable. -
withSetup
public static ReturnVariableDetails withSetup(String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup) Create return variable details with setup instructions. -
hasReturnVariable
public boolean hasReturnVariable()Check if this has a return variable. -
hasSetupInstructions
public boolean hasSetupInstructions()Check if this has setup instructions. -
isEmpty
public boolean isEmpty()Check if this return details object is empty (no return 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). -
returnVariable
Returns the value of thereturnVariablerecord component.- Returns:
- the value of the
returnVariablerecord component
-
returnVariableType
Returns the value of thereturnVariableTyperecord component.- Returns:
- the value of the
returnVariableTyperecord component
-
returnVariableSetup
-