From 5ae47428404cb4199291b29ec6351de6f2fa55e0 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Wed, 4 Jun 2025 19:02:19 -0400 Subject: [PATCH] save work, working on function clause guards, extra pop instructions are showing up after function definitions --- src/compiler.rs | 1 - src/main.rs | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/compiler.rs b/src/compiler.rs index 52bad71..f277a7b 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -1083,7 +1083,6 @@ impl<'a> Compiler<'a> { self.emit_constant(init_val); self.bind(name); - // TODO: close over everything accessed in the function for upvalue in upvalues { self.emit_op(Op::SetUpvalue); self.emit_byte(upvalue.stack_pos); diff --git a/src/main.rs b/src/main.rs index 1723d52..b880a65 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,12 +76,11 @@ pub fn run(src: &'static str) { pub fn main() { env::set_var("RUST_BACKTRACE", "1"); let src = " -fn foo { - () if false -> :no - () if true -> :yes -} +fn foo () -> :foo + +foo + -foo () "; run(src); }