oops, forgot to return the result

This commit is contained in:
numzero 2025-04-19 14:14:39 +03:00
parent d3e0f12f69
commit f6ba112d95

View File

@ -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,
}
}