diff options
Diffstat (limited to 'src/interpret/scope.rs')
| -rw-r--r-- | src/interpret/scope.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/interpret/scope.rs b/src/interpret/scope.rs index de32692..d8b8f43 100644 --- a/src/interpret/scope.rs +++ b/src/interpret/scope.rs @@ -19,10 +19,10 @@ impl Scope { self.scopes.pop(); } - pub fn set_var(&mut self, ident: &Identifier, value: Value) { + pub fn set_var(&mut self, ident: &str, value: Value) { for scope in self.scopes.iter_mut() { if scope.contains_key(ident) { - scope.insert(ident.clone(), value); + scope.insert(ident.to_string(), value); return; } } @@ -31,10 +31,10 @@ impl Scope { .scopes .last_mut() .expect("Tried accessing scope after last frame is gone."); - inner_scope.insert(ident.clone(), value); + inner_scope.insert(ident.to_string(), value); } - pub fn get_var(&self, ident: &Identifier) -> Option<Value> { + pub fn get_var(&self, ident: &str) -> Option<Value> { for scope in self.scopes.iter().rev() { if let Some(value) = scope.get(ident) { return Some(value.clone()); |
