Record Class IRStackFrame
java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.generation.IRStackFrame
- Record Components:
scopeId
- The unique identifier for this scopedebugInfo
- Debug information for this scope (could be null if debug disabled)frameType
- The type of frame (method, function, block, etc.)hasLeftHandSide
- Whether this scope has a left-hand side for result variablescontextData
- Additional context data specific to this frame type
public record IRStackFrame(String scopeId, DebugInfo debugInfo, IRFrameType frameType, boolean hasLeftHandSide, Object contextData)
extends Record
Represents a single frame on the IR generation stack.
Each frame captures the essential context information needed for IR generation at a specific scope level (method, function, block, expression, etc.).
This eliminates the need for parameter threading by providing all contextual information through the stack frame.
-
Constructor Summary
ConstructorsConstructorDescriptionIRStackFrame
(String scopeId, DebugInfo debugInfo, IRFrameType frameType, boolean hasLeftHandSide, Object contextData) Creates an instance of aIRStackFrame
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic IRStackFrame
basic
(String scopeId, DebugInfo debugInfo, IRFrameType frameType) Create a basic frame with just scope and debug info.Returns the value of thecontextData
record component.Returns the value of thedebugInfo
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of theframeType
record component.static IRStackFrame
full
(String scopeId, DebugInfo debugInfo, IRFrameType frameType, boolean hasLeftHandSide, Object contextData) Create a full frame with all parameters.<T> T
getContextData
(Class<T> expectedType) Get typed context data if available and of expected type.boolean
hasContextData
(Class<?> expectedType) Check if this frame has context data of the specified type.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of thehasLeftHandSide
record component.scopeId()
Returns the value of thescopeId
record component.final String
toString()
Returns a string representation of this record class.static IRStackFrame
withContext
(String scopeId, DebugInfo debugInfo, IRFrameType frameType, Object contextData) Create a frame with additional context data.static IRStackFrame
withLeftHandSide
(String scopeId, DebugInfo debugInfo, IRFrameType frameType, boolean hasLeftHandSide) Create a frame with left-hand side indication.
-
Constructor Details
-
IRStackFrame
public IRStackFrame(String scopeId, DebugInfo debugInfo, IRFrameType frameType, boolean hasLeftHandSide, Object contextData) Creates an instance of aIRStackFrame
record class.- Parameters:
scopeId
- the value for thescopeId
record componentdebugInfo
- the value for thedebugInfo
record componentframeType
- the value for theframeType
record componenthasLeftHandSide
- the value for thehasLeftHandSide
record componentcontextData
- the value for thecontextData
record component
-
-
Method Details
-
basic
Create a basic frame with just scope and debug info. -
withLeftHandSide
public static IRStackFrame withLeftHandSide(String scopeId, DebugInfo debugInfo, IRFrameType frameType, boolean hasLeftHandSide) Create a frame with left-hand side indication. -
withContext
public static IRStackFrame withContext(String scopeId, DebugInfo debugInfo, IRFrameType frameType, Object contextData) Create a frame with additional context data. -
full
public static IRStackFrame full(String scopeId, DebugInfo debugInfo, IRFrameType frameType, boolean hasLeftHandSide, Object contextData) Create a full frame with all parameters. -
getContextData
Get typed context data if available and of expected type. -
hasContextData
Check if this frame has context data of the specified type. -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
scopeId
-
debugInfo
-
frameType
-
hasLeftHandSide
public boolean hasLeftHandSide()Returns the value of thehasLeftHandSide
record component.- Returns:
- the value of the
hasLeftHandSide
record component
-
contextData
Returns the value of thecontextData
record component.- Returns:
- the value of the
contextData
record component
-