summaryrefslogtreecommitdiff
path: root/identifiers.c
diff options
context:
space:
mode:
Diffstat (limited to 'identifiers.c')
-rw-r--r--identifiers.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/identifiers.c b/identifiers.c
index 030ec76..3cce0d1 100644
--- a/identifiers.c
+++ b/identifiers.c
@@ -149,6 +149,7 @@ static void ident_add_decl(Identifier i, struct Declaration *d, struct Block *b)
id_decl->decl = d;
id_decl->scope = b;
id_decl->flags = 0;
+ id_decl->kind = IDECL_DECL;
}
static IdentDecl *ident_decl(Identifier i) {
@@ -225,3 +226,16 @@ static bool ident_eq_str(Identifier i, const char *s) {
if (i->parent) return false; /* not at root */
return true;
}
+
+static Location idecl_where(IdentDecl *id) {
+
+ switch (id->kind) {
+ case IDECL_DECL:
+ return id->decl->where;
+ case IDECL_EXPR:
+ return id->expr->where;
+ }
+ assert(0);
+ Location def = {0};
+ return def;
+}