This commit is contained in:
numzero 2025-04-11 20:31:04 +03:00
parent 382cfdd903
commit 9562da5518

View File

@ -1,4 +1,4 @@
use std::{borrow::Cow, collections::HashMap, fmt::Debug, rc::Rc}; use std::{collections::HashMap, fmt::Debug, rc::Rc};
use crate::{ use crate::{
ast::{Constant, Expression, Location}, ast::{Constant, Expression, Location},
@ -41,11 +41,11 @@ impl Scope {
self.variables.get(name.as_ref()).cloned() self.variables.get(name.as_ref()).cloned()
} }
pub fn set(&mut self, name: Cow<str>, value: Value) { pub fn set(&mut self, name: String, value: Value) {
if let Some(value) = value { if let Some(value) = value {
self.variables.insert(name.into(), value); self.variables.insert(name, value);
} else { } else {
self.variables.remove(name.as_ref()); self.variables.remove(&name);
} }
} }
} }