aboutsummaryrefslogtreecommitdiff
path: root/src/ast.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-03-27 03:18:48 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-03-27 03:18:48 +0300
commit78cf00cb506cb86112cb715e4d2d69ec11b20c42 (patch)
tree32a1fd3d1e60343cb1e654900c2d4dedca5e938b /src/ast.c
parent9fb179ab999c3b98caabca09b30c409dc5dd3b3d (diff)
downloadek-78cf00cb506cb86112cb715e4d2d69ec11b20c42.tar.gz
ek-78cf00cb506cb86112cb715e4d2d69ec11b20c42.zip
change typeof to be a full time type
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c8
1 files changed, 7 insertions, 1 deletions
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