harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6d0042e395f6c438f08d3e25ff6e8418fda35808
parent fe4b0856bb0efe95355dd24b849642c01f926701
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Tue, 10 Aug 2021 10:10:05 +0000

gen: fix defers on return

Also enable 16-defer

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Msrc/gen.c | 4+++-
Mtests/configure | 2+-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -1921,7 +1921,9 @@ static struct gen_value gen_expr_return(struct gen_context *ctx, const struct expression *expr) { struct gen_value ret = gen_expr(ctx, expr->_return.value); - gen_defers(ctx, ctx->scope); + for (struct gen_scope *scope = ctx->scope; scope; scope = scope->parent) { + gen_defers(ctx, scope); + } if (type_dealias(ret.type)->storage == STORAGE_VOID) { pushi(ctx->current, NULL, Q_RET, NULL); } else { diff --git a/tests/configure b/tests/configure @@ -55,6 +55,7 @@ EOF 13-tagged \ 14-switch \ 15-enums \ + 16-defer \ 17-alloc \ 20-if \ 24-imports \ @@ -64,7 +65,6 @@ EOF 29-unarithm # Disabled tests - #16-defer \ #18-match \ #19-append \ #21-tuples \