From bad9ab7479d66dfdb1c8e2d18c23fbcff9ec394b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 15 Aug 2023 21:41:29 +0300 Subject: updates to syntax --- src/ast.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ast.c') diff --git a/src/ast.c b/src/ast.c index 2719dd3..3ddf7c4 100644 --- a/src/ast.c +++ b/src/ast.c @@ -411,7 +411,7 @@ struct ast_node *gen_case(struct ast_node *cond, struct ast_node *body) n->_case.body = body; /* TODO: where should I check the fallthrough flag? In the * actualization stage, I guess */ - n->loc = cond->loc; + n->loc = body->loc; return n; } @@ -461,7 +461,8 @@ struct ast_node *gen_type(enum ast_type_kind kind, struct ast_node *id, case AST_TYPE_ARR: n->_type.arr.size = expr; - n->loc = expr->loc; + if (expr) + n->loc = expr->loc; break; case AST_TYPE_TYPEOF: @@ -682,7 +683,7 @@ struct ast_node *gen_lambda(struct ast_node *captures, n->_lambda.captures = captures; n->_lambda.sign = type; n->_lambda.body = body; - n->loc = type->loc; + n->loc = captures->loc; return n; } -- cgit v1.3