diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-02-06 21:15:07 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-02-06 21:15:07 -0500 |
commit | 1894485db067d5d79a32a90da07bd5f0aad433d7 (patch) | |
tree | 24ed1df3e93c757a4fdd957e63cd728021556574 /types.c | |
parent | 5ba1e753dcd745bcb5b81d9098f6c780840be897 (diff) |
new ident system working except for templates
Diffstat (limited to 'types.c')
-rw-r--r-- | types.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -374,7 +374,8 @@ static bool type_of_ident(Typer *tr, Location where, Identifier *ident, Type *t) long nblocks = (long)arr_len(tr->blocks); long idx; for (idx = nblocks - 1; idx >= 0; --idx) { - Identifier translated = ident_translate(i, &tr->blocks[idx]->idents); + Block *b = tr->blocks[idx]; + Identifier translated = ident_translate(i, b ? &b->idents : tr->globals); if (!translated) continue; if (translated->decl_kind != IDECL_NONE) { i = *ident = translated; @@ -2184,6 +2185,7 @@ static bool types_expr(Typer *tr, Expression *e) { static bool types_block(Typer *tr, Block *b) { *(Block **)arr_add(&tr->blocks) = b; + tr->block = b; if (b->flags & BLOCK_FOUND_TYPES) return true; @@ -2219,6 +2221,7 @@ static bool types_block(Typer *tr, Block *b) { } ret: + tr->block = *(Block **)arr_last(tr->blocks); arr_remove_last(&tr->blocks); b->flags |= BLOCK_FOUND_TYPES; return success; |