harec

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

commit de0f6e09c1f773363f69e1a96212d8ab7b48e548
parent b6a0bfc8edb169b9cadd4f705768ca7c2d7080af
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 14 Mar 2021 15:06:30 -0400

check: fix assertion failure on some assigns

Diffstat:
Msrc/check.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -472,8 +472,8 @@ check_expr_assign(struct context *ctx, struct expression *object = xcalloc(1, sizeof(struct expression)); struct expression *value = xcalloc(1, sizeof(struct expression)); - errors = check_expression(ctx, aexpr->assign.object, object, NULL, - errors); + errors = check_expression(ctx, aexpr->assign.object, + object, NULL, errors); expr->assign.op = aexpr->assign.op; @@ -497,7 +497,8 @@ check_expr_assign(struct context *ctx, } else { errors = check_expression(ctx, aexpr->assign.value, value, object->result, errors); - assert(object->type == EXPR_ACCESS + assert(object->type == EXPR_CONSTANT // If error + || object->type == EXPR_ACCESS || object->type == EXPR_SLICE); // Invariant if (object->type == EXPR_SLICE) { if (expr->assign.op != BIN_LEQUAL) {