harec

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

commit e444f9df4be838ca3e17e8f407406f0d1c32aafb
parent a62c0875e2f3d5f42fa1d67936242ef8a9a5aee2
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue,  2 Feb 2021 14:51:54 -0500

gen: fix terminating match on nullable pointer

Diffstat:
Msrc/gen.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gen.c b/src/gen.c @@ -1628,8 +1628,12 @@ gen_match_nullable(struct gen_context *ctx, gen_store(ctx, &val, &mval); } - gen_expression(ctx, _case->value, out); - pushi(ctx->current, NULL, Q_JMP, &obranch, NULL); + if (_case->value->terminates) { + gen_expression(ctx, _case->value, NULL); + } else { + gen_expression(ctx, _case->value, out); + pushi(ctx->current, NULL, Q_JMP, &obranch, NULL); + } push(&ctx->current->body, &flabel); }