From 78cf00cb506cb86112cb715e4d2d69ec11b20c42 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 27 Mar 2023 03:18:48 +0300 Subject: change typeof to be a full time type --- src/ast.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ast.c') diff --git a/src/ast.c b/src/ast.c index d258b91..056cc73 100644 --- a/src/ast.c +++ b/src/ast.c @@ -30,9 +30,15 @@ static struct src_loc loc_span(struct ast_node *left, struct ast_node *right) { struct src_loc loc = {0}; - if (!left || !right) + if (!left && !right) return loc; + if (!left && right) + return right->loc; + + if (left && !right) + return left->loc; + /* this might eventually be a good thing to do, * but right now I'm still having issues with initializing all nodes * with some kind of even slightly accurate location -- cgit v1.3