diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-19 12:08:12 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-19 12:08:12 -0400 |
commit | b5daaa00a4b1049f5e2ddc0bb658a17e0ee1e48f (patch) | |
tree | 60b22b4e48180e417f5b23756836e58a640889a4 /identifiers.c | |
parent | 614026f24a4abce603ea3499d7241abd9383de48 (diff) |
fixed IDECL_EXPR bug; version 0.5
Diffstat (limited to 'identifiers.c')
-rw-r--r-- | identifiers.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/identifiers.c b/identifiers.c index 585ee52..b03a7be 100644 --- a/identifiers.c +++ b/identifiers.c @@ -206,12 +206,18 @@ static int ident_index_in_decl(Identifier i, Declaration *d) { return -1; } -static Location ident_decl_location(Identifier i) { +static Location ident_decl_location(File *file, Identifier i) { switch (i->decl_kind) { case IDECL_DECL: return i->decl->where; - case IDECL_EXPR: - return i->decl_expr->where; + case IDECL_FOR: + if (i == i->decl_for->index) { + return token_location(file, i->decl_for->index_token); + } else { + assert(i == i->decl_for->value); + return token_location(file, i->decl_for->value_token); + } + break; case IDECL_NONE: break; } |