diff --git a/compiler/cl-interpret/src/env.rs b/compiler/cl-interpret/src/env.rs index 89d7bd4..4731674 100644 --- a/compiler/cl-interpret/src/env.rs +++ b/compiler/cl-interpret/src/env.rs @@ -99,6 +99,11 @@ impl Environment { function.call(self, args) } + /// Binds a value to the given name in the current scope. + pub fn bind(&mut self, name: &str, value: impl Into) { + self.insert(name.into(), Some(value.into())); + } + /// Gets all registered globals, bound or unbound. pub fn globals(&self) -> &HashMap> { &self.global