harec

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

commit 25a57362a5eb8133200ee712c9b7449a40a425ae
parent bd6ec6bb88e4805f32fa344b51ad65b944fc8dfb
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date:   Mon, 24 Jan 2022 05:28:44 +0100

append/insert: don't abort on error path

Handle the case where object is actually a define or an error occured when
checking the object without aborting. If we abort here, the user is unable to
see the error message.

Signed-off-by: Bor Grošelj Simić <bor.groseljsimic@telemach.net>

Diffstat:
Msrc/check.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/check.c b/src/check.c @@ -422,7 +422,11 @@ check_expr_append_insert(struct context *ctx, expr->append.is_multi = aexpr->append.is_multi; expr->append.object = xcalloc(sizeof(struct expression), 1); check_expression(ctx, aexpr->append.object, expr->append.object, NULL); - assert(expr->append.object->type == EXPR_ACCESS); + if (expr->append.object->type != EXPR_ACCESS) { + error(ctx, aexpr->append.object->loc, expr, + "Expression must operate on an object"); + return; + }; const struct type *sltype; const char *exprtype_name;