Record Class DefaultCaseDetails
java.lang.Object
java.lang.Record
org.ek9lang.compiler.ir.DefaultCaseDetails
public record DefaultCaseDetails(List<IRInstr> defaultBodyEvaluation, String defaultResult)
extends Record
Record containing default case management information for CONTROL_FLOW_CHAIN constructs.
Default cases handle the fallback behavior when no condition in the condition chain matches: - if/else statements: "else" block - switch statements: "default" case - Question operators: the _isSet() check (default behavior when not null)
Some constructs may not have default cases (e.g., incomplete if statements without else, guarded assignments that only execute conditionally).
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCaseDetails
(List<IRInstr> defaultBodyEvaluation, String defaultResult) Creates an instance of aDefaultCaseDetails
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedefaultBodyEvaluation
record component.Returns the value of thedefaultResult
record component.final boolean
Indicates whether some other object is "equal to" this one.boolean
Check if this has a default case.boolean
Check if this has a default result variable.final int
hashCode()
Returns a hash code value for this object.boolean
isEmpty()
Check if this default details object is empty (no default case).static DefaultCaseDetails
none()
Create empty default case details (no default case).toString()
IR-optimized toString following EK9's bracket-only, no-indentation format.static DefaultCaseDetails
withInstructions
(List<IRInstr> defaultBodyEvaluation) Create default case details with instructions only.static DefaultCaseDetails
withResult
(List<IRInstr> defaultBodyEvaluation, String defaultResult) Create default case details with instructions and result.
-
Constructor Details
-
DefaultCaseDetails
Creates an instance of aDefaultCaseDetails
record class.- Parameters:
defaultBodyEvaluation
- the value for thedefaultBodyEvaluation
record componentdefaultResult
- the value for thedefaultResult
record component
-
-
Method Details
-
none
Create empty default case details (no default case). -
withInstructions
Create default case details with instructions only. -
withResult
public static DefaultCaseDetails withResult(List<IRInstr> defaultBodyEvaluation, String defaultResult) Create default case details with instructions and result. -
hasDefaultCase
public boolean hasDefaultCase()Check if this has a default case. -
hasDefaultResult
public boolean hasDefaultResult()Check if this has a default result variable. -
isEmpty
public boolean isEmpty()Check if this default details object is empty (no default case). -
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)
. -
defaultBodyEvaluation
-
defaultResult
Returns the value of thedefaultResult
record component.- Returns:
- the value of the
defaultResult
record component
-