feat(jit): with

This commit is contained in:
2025-07-18 09:53:41 +08:00
parent 74e819c678
commit b556f1ea2d
6 changed files with 101 additions and 20 deletions

View File

@@ -230,7 +230,7 @@ impl Evaluate for ir::With {
// TODO: Error Handling
env.enter_with(namespace.unwrap_attr_set().into_inner());
let ret = self.expr.eval(engine, env);
env.pop_with();
env.exit_with();
ret
}
}
@@ -284,7 +284,6 @@ impl Evaluate for ir::Const {
impl Evaluate for ir::Var {
fn eval(&self, _: &mut Engine, env: &mut Env) -> Result<Value> {
env.lookup_with(&self.sym).ok_or_else(|| {
Error::EvalError(format!(
"variable {} not found",
@@ -296,8 +295,7 @@ impl Evaluate for ir::Var {
impl Evaluate for ir::Arg {
fn eval(&self, _: &mut Engine, env: &mut Env) -> Result<Value> {
let result = env.lookup_arg(self.level).clone().ok();
Ok(result.unwrap())
env.lookup_arg(self.level).ok()
}
}
@@ -315,7 +313,6 @@ impl Evaluate for ir::Thunk {
impl Evaluate for ir::MaybeThunk {
fn eval(&self, engine: &mut Engine, env: &mut Env) -> Result<Value> {
match self {
ir::MaybeThunk::Const(cnst) => cnst.eval(engine, env),
ir::MaybeThunk::String(string) => string.eval(engine, env),