privatise
This commit is contained in:
parent
9562da5518
commit
ec3b41809d
|
|
@ -32,8 +32,8 @@ impl Debug for Function {
|
|||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct Scope {
|
||||
pub variables: HashMap<String, ValueInner>,
|
||||
pub functions: HashMap<String, Function>,
|
||||
variables: HashMap<String, ValueInner>,
|
||||
functions: HashMap<String, Function>,
|
||||
}
|
||||
|
||||
impl Scope {
|
||||
|
|
@ -48,6 +48,11 @@ impl Scope {
|
|||
self.variables.remove(&name);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_fn(&mut self, name: &'static str, f: impl Fn(Vec<Value>) -> Value + 'static) {
|
||||
self.functions
|
||||
.insert(name.into(), Function::new(name.into(), f));
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Eval {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user