eval refs

This commit is contained in:
me 2025-12-19 00:19:15 +02:00
parent a9e4875f1e
commit 04ec9baabf

View file

@ -134,6 +134,7 @@ fn eval_expr(expr_env: &Env, state: &mut State, expr: &ast::Expr) -> Result<ast:
let closure_env: Env = state.envs.get(env)?.clone();
eval_expr(&closure_env, state, expr)
}
ast::Value::Ref(reference) => Ok(state.variables.get(reference).clone()),
_ => Ok(v.clone()),
},
ast::Expr::Op { lhs, rhs, op } => match op {
@ -143,7 +144,7 @@ fn eval_expr(expr_env: &Env, state: &mut State, expr: &ast::Expr) -> Result<ast:
state.variables.set(reference, rhs.clone());
Ok(rhs)
}
_ => todo!(),
v => Err(Error::NotAReference(v.clone())),
},
/*
_ => {