1
0

Fix identifier bug

This commit is contained in:
Jeff 2024-01-03 15:36:03 -05:00
parent ab149ce010
commit 4e861620ce

View File

@ -37,12 +37,14 @@ impl AbstractTree for Identifier {
fn run(&self, _source: &str, context: &Map) -> Result<Value> { fn run(&self, _source: &str, context: &Map) -> Result<Value> {
if let Some((value, _)) = context.variables()?.get(&self.0) { if let Some((value, _)) = context.variables()?.get(&self.0) {
Ok(value.clone()) if !value.is_none() {
} else { return Ok(value.clone());
Err(Error::VariableIdentifierNotFound(self.inner().clone()))
} }
} }
Err(Error::VariableIdentifierNotFound(self.0.clone()))
}
fn expected_type(&self, context: &Map) -> Result<Type> { fn expected_type(&self, context: &Map) -> Result<Type> {
if let Some((_value, r#type)) = context.variables()?.get(&self.0) { if let Some((_value, r#type)) = context.variables()?.get(&self.0) {
Ok(r#type.clone()) Ok(r#type.clone())