Class IRGenerationStack
java.lang.Object
org.ek9lang.compiler.phase7.generation.IRGenerationStack
Stack-based scope, debug, and context management for IR generation.
This stack provides the transient context management that eliminates parameter threading throughout the IR generation process. Modeled after the successful ScopeStack pattern used in phases 1-6.
Each frame on the stack represents a scope context (method, function, block, expression) with its associated scope ID, debug information, and other contextual information needed for IR generation.
The stack automatically handles nested scope management and provides navigation capabilities to find containing scopes of specific types.
-
Constructor Summary
ConstructorsConstructorDescriptionIRGenerationStack(IRStackFrame baseFrame) Create a new IR generation stack with a base frame. -
Method Summary
Modifier and TypeMethodDescriptionGet current debug info from the top frame.Get current scope ID from the top frame.peek()Look at the top frame without removing it.pop()Pop a frame off the stack.push(IRStackFrame frame) Push a new frame onto the stack.<T> Optional<T> traverseBackToContextData(Class<T> contextType) Navigate back up the stack to find the first frame with context data of the specified type.
-
Constructor Details
-
IRGenerationStack
Create a new IR generation stack with a base frame.
-
-
Method Details
-
push
Push a new frame onto the stack. -
peek
Look at the top frame without removing it. -
pop
Pop a frame off the stack. -
currentScopeId
Get current scope ID from the top frame. -
currentDebugInfo
-
traverseBackToContextData
-