ContextStack class
Manages the execution context stack.
The context stack tracks nested execution contexts, allowing proper handling of:
- Working directory during nested replay files
- Per-context multiline state
- Session recording control
- Error unwinding
Example:
final stack = ContextStack('/home/user/.tom/d4rt');
// Interactive context is created automatically
print(stack.cwd); // '/home/user/.tom/d4rt'
// Push context for file execution
stack.push(ExecutionContext(
workingDirectory: '/project',
sourceFile: 'setup.d4rt',
recordToSession: false,
));
print(stack.depth); // 1
print(stack.cwd); // '/project'
// Pop after execution
stack.pop();
print(stack.cwd); // '/home/user/.tom/d4rt'
Constructors
- ContextStack(String initialWorkingDirectory)
- Creates a context stack with the given initial working directory.
Properties
- current → ExecutionContext
-
The current (top) execution context.
no setter
- cwd → String
-
Current working directory (from current context).
no setter
- depth → int
-
Depth of nesting (0 = interactive root).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isMultilineMode → bool
-
Whether currently in multiline mode (from current context).
no setter
- isRoot → bool
-
Whether at the root (interactive) context.
no setter
- length → int
-
Number of contexts in the stack.
no setter
-
multilineBuffer
→ List<
String> -
Current multiline buffer (from current context).
no setter
- multilineMode → MultilineMode
-
Current multiline mode (from current context).
no setter
- recordToSession → bool
-
Whether to record to session (from current context).
no setter
- root → ExecutionContext
-
The root (interactive) context.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- silent → bool
-
Whether output is currently suppressed (from current context).
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pop(
) → ExecutionContext - Pops the current context and returns to the parent.
-
popToRoot(
) → void - Pops all contexts above the root, returning to interactive mode.
-
push(
ExecutionContext context) → void - Pushes a new execution context onto the stack.
-
toString(
) → String -
A string representation of this object.
override
-
updateWorkingDirectory(
String newDirectory) → void - Updates the working directory of the current context.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited