diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-09-21 17:50:58 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-09-21 20:25:57 +0200 |
| commit | ddd3b6a82b8c0353c942bfba8b89ca5476eedc58 (patch) | |
| tree | a64c350f0f1f82152ff18cfb02fbfdbf39292672 /src/library | |
| parent | 3760748fddd3b793c79c370398a9d4a3fc5afc04 (diff) | |
Tracked memoization
Diffstat (limited to 'src/library')
30 files changed, 97 insertions, 60 deletions
diff --git a/src/library/graphics/hide.rs b/src/library/graphics/hide.rs index 505dd1f6..65684272 100644 --- a/src/library/graphics/hide.rs +++ b/src/library/graphics/hide.rs @@ -14,7 +14,7 @@ impl HideNode { impl Layout for HideNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/graphics/image.rs b/src/library/graphics/image.rs index c0249b3c..7523471d 100644 --- a/src/library/graphics/image.rs +++ b/src/library/graphics/image.rs @@ -41,7 +41,7 @@ impl ImageNode { impl Layout for ImageNode { fn layout( &self, - _: &dyn World, + _: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/graphics/line.rs b/src/library/graphics/line.rs index ebfec1b2..192f8350 100644 --- a/src/library/graphics/line.rs +++ b/src/library/graphics/line.rs @@ -40,7 +40,7 @@ impl LineNode { impl Layout for LineNode { fn layout( &self, - _: &dyn World, + _: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/graphics/shape.rs b/src/library/graphics/shape.rs index d9162557..eea02568 100644 --- a/src/library/graphics/shape.rs +++ b/src/library/graphics/shape.rs @@ -78,7 +78,7 @@ impl<const S: ShapeKind> ShapeNode<S> { impl<const S: ShapeKind> Layout for ShapeNode<S> { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/graphics/transform.rs b/src/library/graphics/transform.rs index 34d45bd0..b110f343 100644 --- a/src/library/graphics/transform.rs +++ b/src/library/graphics/transform.rs @@ -25,7 +25,7 @@ impl MoveNode { impl Layout for MoveNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { @@ -86,7 +86,7 @@ impl<const T: TransformKind> TransformNode<T> { impl<const T: TransformKind> Layout for TransformNode<T> { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/layout/align.rs b/src/library/layout/align.rs index 0c758cf2..705d555b 100644 --- a/src/library/layout/align.rs +++ b/src/library/layout/align.rs @@ -28,7 +28,7 @@ impl AlignNode { impl Layout for AlignNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/layout/columns.rs b/src/library/layout/columns.rs index e0163f63..8ae4394e 100644 --- a/src/library/layout/columns.rs +++ b/src/library/layout/columns.rs @@ -28,7 +28,7 @@ impl ColumnsNode { impl Layout for ColumnsNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/layout/flow.rs b/src/library/layout/flow.rs index 05c10789..7cb52910 100644 --- a/src/library/layout/flow.rs +++ b/src/library/layout/flow.rs @@ -25,7 +25,7 @@ pub enum FlowChild { impl Layout for FlowNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { @@ -149,7 +149,7 @@ impl FlowLayouter { /// Layout a node. pub fn layout_node( &mut self, - world: &dyn World, + world: Tracked<dyn World>, node: &LayoutNode, styles: StyleChain, ) -> SourceResult<()> { diff --git a/src/library/layout/grid.rs b/src/library/layout/grid.rs index cd4fc6b4..2c246df9 100644 --- a/src/library/layout/grid.rs +++ b/src/library/layout/grid.rs @@ -33,7 +33,7 @@ impl GridNode { impl Layout for GridNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { @@ -93,7 +93,7 @@ castable! { /// Performs grid layout. pub struct GridLayouter<'a> { /// The core context. - world: &'a dyn World, + world: Tracked<'a, dyn World>, /// The grid cells. cells: &'a [LayoutNode], /// The column tracks including gutter tracks. @@ -133,7 +133,7 @@ impl<'a> GridLayouter<'a> { /// /// This prepares grid layout by unifying content and gutter tracks. pub fn new( - world: &'a dyn World, + world: Tracked<'a, dyn World>, tracks: Spec<&[TrackSizing]>, gutter: Spec<&[TrackSizing]>, cells: &'a [LayoutNode], diff --git a/src/library/layout/pad.rs b/src/library/layout/pad.rs index 983bfa11..06c3672f 100644 --- a/src/library/layout/pad.rs +++ b/src/library/layout/pad.rs @@ -28,7 +28,7 @@ impl PadNode { impl Layout for PadNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/layout/page.rs b/src/library/layout/page.rs index ba597263..9cbbcca5 100644 --- a/src/library/layout/page.rs +++ b/src/library/layout/page.rs @@ -57,7 +57,7 @@ impl PageNode { /// Layout the page run into a sequence of frames, one per page. pub fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, mut page: usize, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { @@ -180,7 +180,7 @@ impl Marginal { /// Resolve the marginal based on the page number. pub fn resolve( &self, - world: &dyn World, + world: Tracked<dyn World>, page: usize, ) -> SourceResult<Option<Content>> { Ok(match self { diff --git a/src/library/layout/place.rs b/src/library/layout/place.rs index 862c969e..01da62e5 100644 --- a/src/library/layout/place.rs +++ b/src/library/layout/place.rs @@ -21,7 +21,7 @@ impl PlaceNode { impl Layout for PlaceNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/layout/stack.rs b/src/library/layout/stack.rs index a9fc1621..b9a26642 100644 --- a/src/library/layout/stack.rs +++ b/src/library/layout/stack.rs @@ -27,7 +27,7 @@ impl StackNode { impl Layout for StackNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { @@ -168,7 +168,7 @@ impl<'a> StackLayouter<'a> { /// Layout an arbitrary node. pub fn layout_node( &mut self, - world: &dyn World, + world: Tracked<dyn World>, node: &LayoutNode, styles: StyleChain, ) -> SourceResult<()> { diff --git a/src/library/math/mod.rs b/src/library/math/mod.rs index d71f6976..1f5ea8f3 100644 --- a/src/library/math/mod.rs +++ b/src/library/math/mod.rs @@ -48,7 +48,11 @@ impl Show for MathNode { } } - fn realize(&self, _: &dyn World, styles: StyleChain) -> SourceResult<Content> { + fn realize( + &self, + _: Tracked<dyn World>, + styles: StyleChain, + ) -> SourceResult<Content> { let node = self::rex::RexNode { tex: self.formula.clone(), display: self.display, @@ -64,7 +68,7 @@ impl Show for MathNode { fn finalize( &self, - _: &dyn World, + _: Tracked<dyn World>, styles: StyleChain, mut realized: Content, ) -> SourceResult<Content> { diff --git a/src/library/math/rex.rs b/src/library/math/rex.rs index 76ba5177..96e8e438 100644 --- a/src/library/math/rex.rs +++ b/src/library/math/rex.rs @@ -22,7 +22,7 @@ pub struct RexNode { impl Layout for RexNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, _: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/prelude.rs b/src/library/prelude.rs index 48eebaf6..44d1af7f 100644 --- a/src/library/prelude.rs +++ b/src/library/prelude.rs @@ -6,6 +6,7 @@ pub use std::io; pub use std::num::NonZeroUsize; pub use std::sync::Arc; +pub use comemo::Tracked; pub use typst_macros::node; pub use crate::diag::{with_alternative, At, SourceError, SourceResult, StrResult}; diff --git a/src/library/structure/doc.rs b/src/library/structure/doc.rs index ba848b64..c3af3f1c 100644 --- a/src/library/structure/doc.rs +++ b/src/library/structure/doc.rs @@ -9,7 +9,7 @@ impl DocNode { /// Layout the document into a sequence of frames, one per page. pub fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { let mut frames = vec![]; diff --git a/src/library/structure/heading.rs b/src/library/structure/heading.rs index 855c0503..01738496 100644 --- a/src/library/structure/heading.rs +++ b/src/library/structure/heading.rs @@ -82,13 +82,13 @@ impl Show for HeadingNode { } } - fn realize(&self, _: &dyn World, _: StyleChain) -> SourceResult<Content> { + fn realize(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { Ok(Content::block(self.body.clone())) } fn finalize( &self, - world: &dyn World, + world: Tracked<dyn World>, styles: StyleChain, mut realized: Content, ) -> SourceResult<Content> { @@ -149,7 +149,11 @@ pub enum Leveled<T> { impl<T: Cast + Clone> Leveled<T> { /// Resolve the value based on the level. - pub fn resolve(&self, world: &dyn World, level: NonZeroUsize) -> SourceResult<T> { + pub fn resolve( + &self, + world: Tracked<dyn World>, + level: NonZeroUsize, + ) -> SourceResult<T> { Ok(match self { Self::Value(value) => value.clone(), Self::Mapping(mapping) => mapping(level), diff --git a/src/library/structure/list.rs b/src/library/structure/list.rs index f63374f3..9da14733 100644 --- a/src/library/structure/list.rs +++ b/src/library/structure/list.rs @@ -100,7 +100,11 @@ impl<const L: ListKind> Show for ListNode<L> { } } - fn realize(&self, world: &dyn World, styles: StyleChain) -> SourceResult<Content> { + fn realize( + &self, + world: Tracked<dyn World>, + styles: StyleChain, + ) -> SourceResult<Content> { let mut cells = vec![]; let mut number = self.start; @@ -145,7 +149,7 @@ impl<const L: ListKind> Show for ListNode<L> { fn finalize( &self, - _: &dyn World, + _: Tracked<dyn World>, styles: StyleChain, realized: Content, ) -> SourceResult<Content> { @@ -208,7 +212,7 @@ impl Label { /// Resolve the value based on the level. pub fn resolve( &self, - world: &dyn World, + world: Tracked<dyn World>, kind: ListKind, number: usize, ) -> SourceResult<Content> { diff --git a/src/library/structure/reference.rs b/src/library/structure/reference.rs index 5d1dab38..0a9f4f9c 100644 --- a/src/library/structure/reference.rs +++ b/src/library/structure/reference.rs @@ -22,7 +22,7 @@ impl Show for RefNode { } } - fn realize(&self, _: &dyn World, _: StyleChain) -> SourceResult<Content> { + fn realize(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { Ok(Content::Text(format_eco!("@{}", self.0))) } } diff --git a/src/library/structure/table.rs b/src/library/structure/table.rs index f1ca7e03..9f89cd2b 100644 --- a/src/library/structure/table.rs +++ b/src/library/structure/table.rs @@ -72,7 +72,11 @@ impl Show for TableNode { } } - fn realize(&self, world: &dyn World, styles: StyleChain) -> SourceResult<Content> { + fn realize( + &self, + world: Tracked<dyn World>, + styles: StyleChain, + ) -> SourceResult<Content> { let fill = styles.get(Self::FILL); let stroke = styles.get(Self::STROKE).map(RawStroke::unwrap_or_default); let padding = styles.get(Self::PADDING); @@ -110,7 +114,7 @@ impl Show for TableNode { fn finalize( &self, - _: &dyn World, + _: Tracked<dyn World>, styles: StyleChain, realized: Content, ) -> SourceResult<Content> { @@ -129,7 +133,12 @@ pub enum Celled<T> { impl<T: Cast + Clone> Celled<T> { /// Resolve the value based on the cell position. - pub fn resolve(&self, world: &dyn World, x: usize, y: usize) -> SourceResult<T> { + pub fn resolve( + &self, + world: Tracked<dyn World>, + x: usize, + y: usize, + ) -> SourceResult<T> { Ok(match self { Self::Value(value) => value.clone(), Self::Func(func, span) => { diff --git a/src/library/text/deco.rs b/src/library/text/deco.rs index 3d030d45..1242488b 100644 --- a/src/library/text/deco.rs +++ b/src/library/text/deco.rs @@ -48,7 +48,11 @@ impl<const L: DecoLine> Show for DecoNode<L> { dict! { "body" => Value::Content(self.0.clone()) } } - fn realize(&self, _: &dyn World, styles: StyleChain) -> SourceResult<Content> { + fn realize( + &self, + _: Tracked<dyn World>, + styles: StyleChain, + ) -> SourceResult<Content> { Ok(self.0.clone().styled(TextNode::DECO, Decoration { line: L, stroke: styles.get(Self::STROKE).unwrap_or_default(), diff --git a/src/library/text/link.rs b/src/library/text/link.rs index f89bbd67..c06fea55 100644 --- a/src/library/text/link.rs +++ b/src/library/text/link.rs @@ -64,7 +64,7 @@ impl Show for LinkNode { } } - fn realize(&self, _: &dyn World, _: StyleChain) -> SourceResult<Content> { + fn realize(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { Ok(self.body.clone().unwrap_or_else(|| match &self.dest { Destination::Url(url) => { let mut text = url.as_str(); @@ -80,7 +80,7 @@ impl Show for LinkNode { fn finalize( &self, - _: &dyn World, + _: Tracked<dyn World>, styles: StyleChain, mut realized: Content, ) -> SourceResult<Content> { diff --git a/src/library/text/mod.rs b/src/library/text/mod.rs index 55b866cb..934f5e15 100644 --- a/src/library/text/mod.rs +++ b/src/library/text/mod.rs @@ -507,7 +507,7 @@ impl Show for StrongNode { dict! { "body" => Value::Content(self.0.clone()) } } - fn realize(&self, _: &dyn World, _: StyleChain) -> SourceResult<Content> { + fn realize(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { Ok(self.0.clone().styled(TextNode::BOLD, Toggle)) } } @@ -532,7 +532,7 @@ impl Show for EmphNode { dict! { "body" => Value::Content(self.0.clone()) } } - fn realize(&self, _: &dyn World, _: StyleChain) -> SourceResult<Content> { + fn realize(&self, _: Tracked<dyn World>, _: StyleChain) -> SourceResult<Content> { Ok(self.0.clone().styled(TextNode::ITALIC, Toggle)) } } diff --git a/src/library/text/par.rs b/src/library/text/par.rs index 00a1e034..6910c23a 100644 --- a/src/library/text/par.rs +++ b/src/library/text/par.rs @@ -64,7 +64,7 @@ impl ParNode { impl Layout for ParNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { @@ -496,7 +496,7 @@ fn collect<'a>( /// Prepare paragraph layout by shaping the whole paragraph and layouting all /// contained inline-level nodes. fn prepare<'a>( - world: &dyn World, + world: Tracked<dyn World>, par: &'a ParNode, text: &'a str, segments: Vec<(Segment<'a>, StyleChain<'a>)>, @@ -561,7 +561,7 @@ fn prepare<'a>( /// items for them. fn shape_range<'a>( items: &mut Vec<Item<'a>>, - world: &dyn World, + world: Tracked<dyn World>, bidi: &BidiInfo<'a>, range: Range, styles: StyleChain<'a>, @@ -627,7 +627,7 @@ fn shared_get<'a, K: Key<'a>>( /// Find suitable linebreaks. fn linebreak<'a>( p: &'a Preparation<'a>, - world: &dyn World, + world: Tracked<dyn World>, width: Length, ) -> Vec<Line<'a>> { match p.styles.get(ParNode::LINEBREAKS) { @@ -641,7 +641,7 @@ fn linebreak<'a>( /// very unbalanced line, but is fast and simple. fn linebreak_simple<'a>( p: &'a Preparation<'a>, - world: &dyn World, + world: Tracked<dyn World>, width: Length, ) -> Vec<Line<'a>> { let mut lines = vec![]; @@ -701,7 +701,7 @@ fn linebreak_simple<'a>( /// text. fn linebreak_optimized<'a>( p: &'a Preparation<'a>, - world: &dyn World, + world: Tracked<dyn World>, width: Length, ) -> Vec<Line<'a>> { /// The cost of a line or paragraph layout. @@ -914,7 +914,7 @@ impl Breakpoints<'_> { /// Create a line which spans the given range. fn line<'a>( p: &'a Preparation, - world: &dyn World, + world: Tracked<dyn World>, mut range: Range, mandatory: bool, hyphen: bool, @@ -1022,7 +1022,7 @@ fn line<'a>( /// Combine layouted lines into one frame per region. fn stack( p: &Preparation, - world: &dyn World, + world: Tracked<dyn World>, lines: &[Line], regions: &Regions, ) -> SourceResult<Vec<Frame>> { @@ -1072,7 +1072,7 @@ fn stack( /// Commit to a line and build its frame. fn commit( p: &Preparation, - world: &dyn World, + world: Tracked<dyn World>, line: &Line, regions: &Regions, width: Length, diff --git a/src/library/text/raw.rs b/src/library/text/raw.rs index 5bce2a90..e7c73a91 100644 --- a/src/library/text/raw.rs +++ b/src/library/text/raw.rs @@ -59,7 +59,11 @@ impl Show for RawNode { } } - fn realize(&self, _: &dyn World, styles: StyleChain) -> SourceResult<Content> { + fn realize( + &self, + _: Tracked<dyn World>, + styles: StyleChain, + ) -> SourceResult<Content> { let lang = styles.get(Self::LANG).as_ref().map(|s| s.to_lowercase()); let foreground = THEME .settings @@ -111,7 +115,7 @@ impl Show for RawNode { fn finalize( &self, - _: &dyn World, + _: Tracked<dyn World>, styles: StyleChain, mut realized: Content, ) -> SourceResult<Content> { diff --git a/src/library/text/repeat.rs b/src/library/text/repeat.rs index 78a21069..e3bae3fc 100644 --- a/src/library/text/repeat.rs +++ b/src/library/text/repeat.rs @@ -14,7 +14,7 @@ impl RepeatNode { impl Layout for RepeatNode { fn layout( &self, - world: &dyn World, + world: Tracked<dyn World>, regions: &Regions, styles: StyleChain, ) -> SourceResult<Vec<Frame>> { diff --git a/src/library/text/shaping.rs b/src/library/text/shaping.rs index c1d0341b..16989acf 100644 --- a/src/library/text/shaping.rs +++ b/src/library/text/shaping.rs @@ -80,7 +80,7 @@ impl<'a> ShapedText<'a> { /// /// The `justification` defines how much extra advance width each /// [justifiable glyph](ShapedGlyph::is_justifiable) will get. - pub fn build(&self, world: &dyn World, justification: Length) -> Frame { + pub fn build(&self, world: Tracked<dyn World>, justification: Length) -> Frame { let (top, bottom) = self.measure(world); let size = Size::new(self.width, top + bottom); @@ -144,7 +144,7 @@ impl<'a> ShapedText<'a> { } /// Measure the top and bottom extent of this text. - fn measure(&self, world: &dyn World) -> (Length, Length) { + fn measure(&self, world: Tracked<dyn World>) -> (Length, Length) { let mut top = Length::zero(); let mut bottom = Length::zero(); @@ -199,7 +199,7 @@ impl<'a> ShapedText<'a> { /// shaping process if possible. pub fn reshape( &'a self, - world: &dyn World, + world: Tracked<dyn World>, text_range: Range<usize>, ) -> ShapedText<'a> { if let Some(glyphs) = self.slice_safe_to_break(text_range.clone()) { @@ -218,7 +218,7 @@ impl<'a> ShapedText<'a> { } /// Push a hyphen to end of the text. - pub fn push_hyphen(&mut self, world: &dyn World) { + pub fn push_hyphen(&mut self, world: Tracked<dyn World>) { families(self.styles).find_map(|family| { let font = world .book() @@ -306,7 +306,7 @@ impl Debug for ShapedText<'_> { /// Holds shaping results and metadata common to all shaped segments. struct ShapingContext<'a> { - world: &'a dyn World, + world: Tracked<'a, dyn World>, glyphs: Vec<ShapedGlyph>, used: Vec<Font>, styles: StyleChain<'a>, @@ -319,7 +319,7 @@ struct ShapingContext<'a> { /// Shape text into [`ShapedText`]. pub fn shape<'a>( - world: &dyn World, + world: Tracked<dyn World>, text: &'a str, styles: StyleChain<'a>, dir: Dir, diff --git a/src/library/text/shift.rs b/src/library/text/shift.rs index b359c5ed..6a5415e8 100644 --- a/src/library/text/shift.rs +++ b/src/library/text/shift.rs @@ -42,7 +42,11 @@ impl<const S: ScriptKind> Show for ShiftNode<S> { dict! { "body" => Value::Content(self.0.clone()) } } - fn realize(&self, world: &dyn World, styles: StyleChain) -> SourceResult<Content> { + fn realize( + &self, + world: Tracked<dyn World>, + styles: StyleChain, + ) -> SourceResult<Content> { let mut transformed = None; if styles.get(Self::TYPOGRAPHIC) { if let Some(text) = search_text(&self.0, S) { @@ -91,7 +95,7 @@ fn search_text(content: &Content, mode: ScriptKind) -> Option<EcoString> { /// Checks whether the first retrievable family contains all code points of the /// given string. -fn is_shapable(world: &dyn World, text: &str, styles: StyleChain) -> bool { +fn is_shapable(world: Tracked<dyn World>, text: &str, styles: StyleChain) -> bool { for family in styles.get(TextNode::FAMILY).iter() { if let Some(font) = world .book() diff --git a/src/library/utility/mod.rs b/src/library/utility/mod.rs index 3fc413f7..d9b19d64 100644 --- a/src/library/utility/mod.rs +++ b/src/library/utility/mod.rs @@ -10,7 +10,9 @@ pub use data::*; pub use math::*; pub use string::*; -use crate::eval::{Eval, Scopes, Vm}; +use comemo::Track; + +use crate::eval::{Eval, Route, Scopes, Vm}; use crate::library::prelude::*; use crate::source::Source; @@ -39,7 +41,8 @@ pub fn eval(vm: &mut Vm, args: &mut Args) -> SourceResult<Value> { // Evaluate the source. let std = &vm.world.config().std; let scopes = Scopes::new(Some(std)); - let mut sub = Vm::new(vm.world, vec![], scopes); + let route = Route::default(); + let mut sub = Vm::new(vm.world, route.track(), None, scopes); let result = ast.eval(&mut sub); // Handle control flow. |
