summaryrefslogtreecommitdiff
path: root/src/model/vm.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-03 11:44:53 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-03 13:35:39 +0100
commit37a7afddfaffd44cb9bc013c9506599267e08983 (patch)
tree20e7d62d3c5418baff01a21d0406b91bf3096214 /src/model/vm.rs
parent56342bd972a13ffe21beaf2b87ab7eb1597704b4 (diff)
Split crates
Diffstat (limited to 'src/model/vm.rs')
-rw-r--r--src/model/vm.rs23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/model/vm.rs b/src/model/vm.rs
index 4de57d1c..db0bf77c 100644
--- a/src/model/vm.rs
+++ b/src/model/vm.rs
@@ -2,11 +2,11 @@ use std::path::PathBuf;
use comemo::Tracked;
-use super::{Content, Route, Scopes, Value};
-use crate::diag::{SourceError, StrResult};
+use super::{LangItems, Route, Scopes, Value};
+use crate::diag::{error, SourceError, StrResult};
use crate::syntax::{SourceId, Span};
-use crate::util::{EcoString, PathExt};
-use crate::{LangItems, World};
+use crate::util::PathExt;
+use crate::World;
/// A virtual machine.
pub struct Vm<'a> {
@@ -20,6 +20,8 @@ pub struct Vm<'a> {
pub scopes: Scopes<'a>,
/// A control flow event that is currently happening.
pub flow: Option<Flow>,
+ /// The language items.
+ pub items: LangItems,
}
impl<'a> Vm<'a> {
@@ -36,6 +38,7 @@ impl<'a> Vm<'a> {
location,
scopes,
flow: None,
+ items: world.config().items,
}
}
@@ -54,18 +57,6 @@ impl<'a> Vm<'a> {
Err("cannot access file system from here".into())
}
-
- /// The language items.
- pub fn items(&self) -> &LangItems {
- &self.world.config().items
- }
-
- /// Create text content.
- ///
- /// This is a shorthand for `(vm.items().text)(..)`.
- pub fn text(&self, text: impl Into<EcoString>) -> Content {
- (self.items().text)(text.into())
- }
}
/// A control flow event that occurred during evaluation.