summaryrefslogtreecommitdiff
path: root/toc.c
diff options
context:
space:
mode:
Diffstat (limited to 'toc.c')
-rw-r--r--toc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/toc.c b/toc.c
index 85c0404..c7dc473 100644
--- a/toc.c
+++ b/toc.c
@@ -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;
}