save work, working on function clause guards, extra pop instructions are showing up after function definitions

This commit is contained in:
Scott Richmond 2025-06-04 19:02:19 -04:00
parent 0f8645d2eb
commit 5ae4742840
2 changed files with 4 additions and 6 deletions

View File

@ -1083,7 +1083,6 @@ impl<'a> Compiler<'a> {
self.emit_constant(init_val); self.emit_constant(init_val);
self.bind(name); self.bind(name);
// TODO: close over everything accessed in the function
for upvalue in upvalues { for upvalue in upvalues {
self.emit_op(Op::SetUpvalue); self.emit_op(Op::SetUpvalue);
self.emit_byte(upvalue.stack_pos); self.emit_byte(upvalue.stack_pos);

View File

@ -76,12 +76,11 @@ pub fn run(src: &'static str) {
pub fn main() { pub fn main() {
env::set_var("RUST_BACKTRACE", "1"); env::set_var("RUST_BACKTRACE", "1");
let src = " let src = "
fn foo { fn foo () -> :foo
() if false -> :no
() if true -> :yes foo
}
foo ()
"; ";
run(src); run(src);
} }