From 937a559e7f1e83391769f3c367ea902df540f4ab Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 27 May 2024 16:33:14 -0400 Subject: Bugfix for void thunks --- compile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compile.c b/compile.c index af399a69..891d22c8 100644 --- a/compile.c +++ b/compile.c @@ -1528,7 +1528,8 @@ CORD compile(env_t *env, ast_t *ast) // Find which variables are captured in the closure: env_t *tmp_scope = fresh_scope(body_scope); for (ast_list_t *stmt = Match(lambda->body, Block)->statements; stmt; stmt = stmt->next) { - if (stmt->next) + type_t *stmt_type = get_type(tmp_scope, stmt->ast); + if (stmt->next || (stmt_type->tag == VoidType || stmt_type->tag == AbortType)) (void)compile_statement(tmp_scope, stmt->ast); else (void)compile(tmp_scope, stmt->ast); -- cgit v1.2.3