summaryrefslogtreecommitdiff
path: root/src/exec/context.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-20 20:21:56 +0200
committerLaurenz <laurmaedje@gmail.com>2021-07-21 11:28:29 +0200
commit9488b1b850152eb564dbfefc898c962bdac73eb4 (patch)
tree0a99487cddfee1a46b5802dc6b64c81b70e549da /src/exec/context.rs
parent8000783f95ee007d9dda6f1dcc1c42c8e607b122 (diff)
Main context struct
Diffstat (limited to 'src/exec/context.rs')
-rw-r--r--src/exec/context.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/exec/context.rs b/src/exec/context.rs
index 04c0169d..925fd7de 100644
--- a/src/exec/context.rs
+++ b/src/exec/context.rs
@@ -10,6 +10,7 @@ use crate::layout::{
LayoutNode, LayoutTree, PadNode, PageRun, ParChild, ParNode, StackChild, StackNode,
};
use crate::syntax::{Span, SyntaxTree};
+use crate::Context;
/// The context for execution.
pub struct ExecContext {
@@ -28,13 +29,13 @@ pub struct ExecContext {
impl ExecContext {
/// Create a new execution context with a base state.
- pub fn new(state: State) -> Self {
+ pub fn new(ctx: &mut Context) -> Self {
Self {
+ state: ctx.state.clone(),
diags: DiagSet::new(),
tree: LayoutTree { runs: vec![] },
- page: Some(PageBuilder::new(&state, true)),
- stack: StackBuilder::new(&state),
- state,
+ page: Some(PageBuilder::new(&ctx.state, true)),
+ stack: StackBuilder::new(&ctx.state),
}
}