summaryrefslogtreecommitdiff
path: root/parse/use.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-01-17 22:18:26 -0800
committerOri Bernstein <ori@eigenstate.org>2018-01-17 22:18:26 -0800
commit490e90d2122d80bce4e5f710e046b90fc9cc31ca (patch)
treefe90f739ae700c7f68bdf2f1fdaec2df2dd3d21f /parse/use.c
parent8e1bb5d4fc204ce149ceb545aef7b783d73641bc (diff)
downloadmc-490e90d2122d80bce4e5f710e046b90fc9cc31ca.tar.gz
Hack in seqaux.
It's not perfect, and the right solution would be to keep a trait->aux mapping, but for now it works good enough.
Diffstat (limited to 'parse/use.c')
-rw-r--r--parse/use.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/parse/use.c b/parse/use.c
index cf9ba90..605b3be 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -236,6 +236,7 @@ typickle(FILE *fd, Type *ty)
if (ty->spec[i]->aux)
wrtype(fd, ty->spec[i]->aux);
}
+ wrtype(fd, ty->seqaux);
wrint(fd, ty->nsub);
switch (ty->type) {
case Tyunres:
@@ -312,6 +313,10 @@ traitpickle(FILE *fd, Trait *tr)
static void
wrtype(FILE *fd, Type *ty)
{
+ if (!ty) {
+ wrint(fd, 0);
+ return;
+ }
if (ty->tid >= Builtinmask)
die("Type id %d for %s too big", ty->tid, tystr(ty));
if (ty->vis == Visbuiltin)
@@ -326,7 +331,9 @@ rdtype(FILE *fd, Type **dest)
uintptr_t tid;
tid = rdint(fd);
- if (tid & Builtinmask) {
+ if (tid == 0) {
+ return;
+ } else if (tid & Builtinmask) {
*dest = mktype(Zloc, tid & ~Builtinmask);
} else {
typefix = xrealloc(typefix, (ntypefix + 1) * sizeof(typefix[0]));
@@ -382,6 +389,7 @@ tyunpickle(FILE *fd)
if (rdbool(fd))
rdtype(fd, &ty->spec[i]->aux);
}
+ rdtype(fd, &ty->seqaux);
ty->nsub = rdint(fd);
if (ty->nsub > 0)
ty->sub = zalloc(ty->nsub * sizeof(Type *));