aboutsummaryrefslogtreecommitdiff
path: root/src/ast.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-08-15 21:41:29 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-08-15 21:41:29 +0300
commitbad9ab7479d66dfdb1c8e2d18c23fbcff9ec394b (patch)
treed43dd3a26685c9adc8201dfe1a4035418175c1eb /src/ast.c
parent5ffc39352ef0195697953e9318b8a17c79e7ae84 (diff)
downloadek-bad9ab7479d66dfdb1c8e2d18c23fbcff9ec394b.tar.gz
ek-bad9ab7479d66dfdb1c8e2d18c23fbcff9ec394b.zip
updates to syntax
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c7
1 files changed, 4 insertions, 3 deletions
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;
}