From f6ba112d95c011318f46cb149e608db0fd08b825 Mon Sep 17 00:00:00 2001 From: numzero Date: Sat, 19 Apr 2025 14:14:39 +0300 Subject: [PATCH] oops, forgot to return the result --- src/twopass.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/twopass.rs b/src/twopass.rs index 8d25ae4..0d53391 100644 --- a/src/twopass.rs +++ b/src/twopass.rs @@ -226,6 +226,11 @@ fn build_function(parent: &BuildContext<'_>, code: &ast::Function) -> Function { } } } + let ret = Box::new(if let Some(ret) = &code.ret { + build_expression(&scope, &ret) + } else { + Expression::Constant(ast::Constant::Nil) + }); let scope = scope.scope.into_inner().finish(); Function { name: code.name.clone(), @@ -233,7 +238,7 @@ fn build_function(parent: &BuildContext<'_>, code: &ast::Function) -> Function { locals: scope.locals, upvalues: scope.upvalues, body, - ret: Box::new(Expression::Constant(ast::Constant::Nil)), + ret, } }