summaryrefslogtreecommitdiff
path: root/toc.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-11-03 17:25:27 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2019-11-03 17:25:27 -0500
commit1d4195ce71dcb7c5ca62e68c399af5f091b3e947 (patch)
treeaa231acb8296d3f9e19711ddf1aa8fb67a5088c7 /toc.c
parent575ff90da3be49ac5b478d5cbb1765bbda27a80e (diff)
replaced user-defined type system (there are still bugs apparently though)
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;
}