push method
Pushes a new execution context onto the stack.
The new context's parent is set to the current context.
Throws MaxNestingDepthException if maximum depth is exceeded.
Implementation
void push(ExecutionContext context) {
if (depth >= maxDepth) {
throw MaxNestingDepthException(maxDepth);
}
// Create new context with parent reference
final newContext = ExecutionContext(
workingDirectory: context.workingDirectory,
sourceFile: context.sourceFile,
recordToSession: context.recordToSession,
silent: context.silent,
parent: current,
);
_stack.add(newContext);
}