Fixed unary minus

This commit is contained in:
2026-07-09 10:17:31 -05:00
parent 9a0716ced0
commit a34bbba4b1
6 changed files with 62 additions and 14 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ fn get_value(v: Value, scopes: &mut [Scope]) -> Result<TeaValue, InterpreterErro
match v {
Value::Lit(t) => Ok(t),
Value::Id(s) => {
match scopes.iter().rev().skip_while(|scope| !scope.contains_key(&s)).next() {
match scopes.iter().rev().find(|scope| scope.contains_key(&s)) {
None => Err(InterpreterError::new("undefined variable")),
Some(scope) => match scope.get(&s).unwrap() {
VarType::Const(t) => Ok(t.clone()),