diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-02-17 15:47:54 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-02-17 17:32:56 +0100 |
| commit | c5e67af22bd6242366819879be84c10c4dd135be (patch) | |
| tree | d857b99b26401d1b3b74c4cebacbf086c25bef40 /src/eval/scope.rs | |
| parent | 3d965ae6a479636a13b2e2f2344e8d97bedece1f (diff) | |
Merge eval and layout contexts into `Vm`
Diffstat (limited to 'src/eval/scope.rs')
| -rw-r--r-- | src/eval/scope.rs | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/eval/scope.rs b/src/eval/scope.rs index ed4ff70d..0df4c4df 100644 --- a/src/eval/scope.rs +++ b/src/eval/scope.rs @@ -4,7 +4,7 @@ use std::hash::{Hash, Hasher}; use std::iter; use std::sync::{Arc, RwLock}; -use super::{Args, Class, Construct, EvalContext, Func, Set, Value}; +use super::{Args, Class, Construct, Func, Set, Value, Vm}; use crate::diag::TypResult; use crate::util::EcoString; @@ -40,21 +40,6 @@ impl<'a> Scopes<'a> { self.top = self.scopes.pop().expect("no pushed scope"); } - /// Define a constant variable with a value in the active scope. - pub fn def_const(&mut self, var: impl Into<EcoString>, value: impl Into<Value>) { - self.top.def_const(var, value); - } - - /// Define a mutable variable with a value in the active scope. - pub fn def_mut(&mut self, var: impl Into<EcoString>, value: impl Into<Value>) { - self.top.def_mut(var, value); - } - - /// Define a variable with a slot in the active scope. - pub fn def_slot(&mut self, var: impl Into<EcoString>, slot: Slot) { - self.top.def_slot(var, slot); - } - /// Look up the slot of a variable. pub fn get(&self, var: &str) -> Option<&Slot> { iter::once(&self.top) @@ -101,7 +86,7 @@ impl Scope { pub fn def_func( &mut self, name: &'static str, - func: fn(&mut EvalContext, &mut Args) -> TypResult<Value>, + func: fn(&mut Vm, &mut Args) -> TypResult<Value>, ) { self.def_const(name, Func::native(name, func)); } |
