diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-15 16:53:02 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-15 16:53:02 +0100 |
| commit | d763f0f5a6a700352ee8926c15c8e58624f705c9 (patch) | |
| tree | d287edfdab9793a796404516c7313689e4e69964 /src/eval/context.rs | |
| parent | 0f0416054f263b80ccec1a463ce4ab20913bdf71 (diff) | |
Split state and scopes, less ref-counting 🔀
Diffstat (limited to 'src/eval/context.rs')
| -rw-r--r-- | src/eval/context.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/eval/context.rs b/src/eval/context.rs index 1e09aaaf..a998bbdc 100644 --- a/src/eval/context.rs +++ b/src/eval/context.rs @@ -6,7 +6,6 @@ use fontdock::FontStyle; use super::*; use crate::diag::Diag; use crate::diag::{Deco, Feedback, Pass}; -use crate::env::SharedEnv; use crate::geom::{ChildAlign, Dir, Gen, LayoutDirs, Length, Linear, Sides, Size}; use crate::layout::{ Expansion, Node, NodePad, NodePages, NodePar, NodeSpacing, NodeStack, NodeText, Tree, @@ -14,9 +13,11 @@ use crate::layout::{ /// The context for evaluation. #[derive(Debug)] -pub struct EvalContext { +pub struct EvalContext<'a> { /// The environment from which resources are gathered. - pub env: SharedEnv, + pub env: &'a mut Env, + /// The active scopes. + pub scopes: Scopes<'a>, /// The active evaluation state. pub state: State, /// The accumulated feedback. @@ -34,11 +35,12 @@ pub struct EvalContext { inner: Vec<Node>, } -impl EvalContext { - /// Create a new evaluation context with a base state. - pub fn new(env: SharedEnv, state: State) -> Self { +impl<'a> EvalContext<'a> { + /// Create a new evaluation context with a base state and scope. + pub fn new(env: &'a mut Env, scope: &'a Scope, state: State) -> Self { Self { env, + scopes: Scopes::new(scope), state, groups: vec![], inner: vec![], |
