fix: Propagate errors encountered in argument evaluation (#308)

fixes #301

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2024-08-31 13:46:55 -07:00
committed by GitHub
parent af5071446b
commit a4a80d7fc6
2 changed files with 18 additions and 11 deletions

View File

@@ -2283,15 +2283,8 @@ impl Interpreter {
};
let mut param_values = Vec::with_capacity(params.len());
let mut error = None;
for p in params {
match self.eval_expr(p) {
Ok(v) => param_values.push(v),
Err(e) => {
error = Some(Err(e));
break;
}
}
param_values.push(self.eval_expr(p)?);
}
let orig_fcn_path = fcn_path;
@@ -2308,9 +2301,6 @@ impl Interpreter {
if param_values.iter().any(|v| v == &Value::Undefined) {
return Ok(Value::Undefined);
}
if let Some(err) = error {
err?;
};
return Ok(v.clone());
}
_ => orig_fcn_path.clone(),