Record Class ReturnVariableDetails
java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.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 aReturnVariableDetails
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.static ReturnVariableDetails
forVariable
(String returnVariable, String returnVariableType) Create return variable details for existing variable.final int
hashCode()
Returns a hash code value for this object.boolean
Check if this has a return variable.boolean
Check if this has setup instructions.boolean
isEmpty()
Check if this return details object is empty (no return variable).static ReturnVariableDetails
none()
Create empty return variable details (no return variable).Returns the value of thereturnVariable
record component.Returns the value of thereturnVariableSetup
record component.Returns the value of thereturnVariableType
record component.toString()
IR-optimized toString following EK9's bracket-only, no-indentation format.static ReturnVariableDetails
Create return variable details with setup instructions.
-
Constructor Details
-
ReturnVariableDetails
public ReturnVariableDetails(String returnVariable, String returnVariableType, List<IRInstr> returnVariableSetup) Creates an instance of aReturnVariableDetails
record class.- Parameters:
returnVariable
- the value for thereturnVariable
record componentreturnVariableType
- the value for thereturnVariableType
record componentreturnVariableSetup
- the value for thereturnVariableSetup
record 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 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
-