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

@@ -463,7 +463,12 @@ impl JITCompile for Let {
impl JITCompile for With {
fn compile(&self, ctx: &mut JITContext, engine: ir::Value, env: ir::Value) -> StackSlot {
todo!()
let namespace = self.namespace.compile(ctx, engine, env);
ctx.enter_with(env, namespace);
let ret = self.expr.compile(ctx, engine, env);
ctx.exit_with(env);
ctx.free_slot(namespace);
ret
}
}
@@ -519,7 +524,7 @@ impl JITCompile for Str {
impl JITCompile for Var {
fn compile(&self, ctx: &mut JITContext, engine: ir::Value, env: ir::Value) -> StackSlot {
todo!()
ctx.lookup(env, &self.sym)
}
}