diff --git a/src/abstract_tree/function_call.rs b/src/abstract_tree/function_call.rs index aae7faa..27bd125 100644 --- a/src/abstract_tree/function_call.rs +++ b/src/abstract_tree/function_call.rs @@ -61,6 +61,12 @@ impl AbstractTree for FunctionCall { results.push(result); } + for identifier in definition.identifiers() { + let key = identifier.inner(); + + context.remove(&key); + } + Ok(Value::List(results)) } } diff --git a/src/evaluator.rs b/src/evaluator.rs index 6465c0a..fb79cf8 100644 --- a/src/evaluator.rs +++ b/src/evaluator.rs @@ -86,8 +86,6 @@ impl<'context, 'code> Evaluator<'context, 'code> { let item_count = root_node.child_count(); let mut results = Vec::with_capacity(item_count); - println!("{}", root_node.to_sexp()); - for item_node in root_node.children(&mut cursor) { let item_result = Item::from_syntax_node(item_node, self.source); diff --git a/src/value/variable_map.rs b/src/value/variable_map.rs index fa114ae..d589c3d 100644 --- a/src/value/variable_map.rs +++ b/src/value/variable_map.rs @@ -108,6 +108,13 @@ impl VariableMap { } } + /// Removes and assignmed variable. + /// + /// TODO: Support dot notation. + pub fn remove(&mut self, key: &str) -> Option { + self.variables.remove(key) + } + /// Returns a reference to the inner BTreeMap. pub fn inner(&self) -> &BTreeMap { &self.variables