aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-05-27 16:33:14 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-05-27 16:33:14 -0400
commit937a559e7f1e83391769f3c367ea902df540f4ab (patch)
treee77842f3888d13cdfad0a1cdb36cdae82ec89eb7 /compile.c
parent6bd755eb24c9a81cf9204028168039c4297a4f68 (diff)
Bugfix for void thunks
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c3
1 files changed, 2 insertions, 1 deletions
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);