From 890467e02c50f0df9a43098bd5dc2a1e9a78a3a0 Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Tue, 24 Sep 2024 16:53:41 -0700 Subject: [PATCH] Compiler emits return instructions Another failure on my part to write the compiler correctly. oops Signed-off-by: Alek Ratzloff --- src/compiler.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler.rs b/src/compiler.rs index 4f9e3d2..f185437 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -701,6 +701,7 @@ impl StmtVisitor for Compiler<'_> { let nil = self.insert_constant(self.create_nil())?; self.emit(stmt_line_number(stmt), Op::PushConstant(nil)); } + self.emit(stmt_line_number(stmt), Op::Return); Ok(()) } fn visit_if_stmt(&mut self, stmt: &IfStmt) -> Result<()> {