diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-11-03 17:25:27 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-11-03 17:25:27 -0500 |
commit | 1d4195ce71dcb7c5ca62e68c399af5f091b3e947 (patch) | |
tree | aa231acb8296d3f9e19711ddf1aa8fb67a5088c7 /toc.c | |
parent | 575ff90da3be49ac5b478d5cbb1765bbda27a80e (diff) |
replaced user-defined type system (there are still bugs apparently though)
Diffstat (limited to 'toc.c')
-rw-r--r-- | toc.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -23,10 +23,18 @@ #include "parse.c" #include "scope.c" +static Type *type_user_underlying(Type *t) { + assert(t->kind == TYPE_USER); + Declaration *d = t->user.decl; + assert(d->flags & DECL_FLAG_FOUND_VAL); + return (d->type.kind == TYPE_TUPLE ? d->val.tuple[t->user.index] : d->val).type; +} static Type *type_inner(Type *t) { - while (t && t->kind == TYPE_USER) - t = ident_typeval(t->user.name); + assert(t->flags & TYPE_FLAG_RESOLVED); + while (t->kind == TYPE_USER) { + t = type_user_underlying(t); + } return t; } |