summaryrefslogtreecommitdiff
path: root/parse/use.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-01-14 23:22:16 -0800
committerOri Bernstein <ori@eigenstate.org>2017-01-14 23:22:16 -0800
commit4078198dee11c72b6e735e704d21a2c0f39cb575 (patch)
tree4ceffbc56b47f0b5f57f196ab2203c1ecca5528d /parse/use.c
parent0ac48a57880b009dc00c756882d26ab7ac0974f4 (diff)
downloadmc-4078198dee11c72b6e735e704d21a2c0f39cb575.tar.gz
Unfuck cross module traits a bit.
Mildly tested.
Diffstat (limited to 'parse/use.c')
-rw-r--r--parse/use.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/parse/use.c b/parse/use.c
index 59421b1..70cd299 100644
--- a/parse/use.c
+++ b/parse/use.c
@@ -400,6 +400,7 @@ static Type *tyunpickle(FILE *fd)
Trait *traitunpickle(FILE *fd)
{
Trait *tr;
+ Node *fn;
size_t i, n;
intptr_t uid;
@@ -423,8 +424,11 @@ Trait *traitunpickle(FILE *fd)
for (i = 0; i < n; i++)
lappend(&tr->memb, &tr->nmemb, rdsym(fd, tr));
n = rdint(fd);
- for (i = 0; i < n; i++)
- lappend(&tr->funcs, &tr->nfuncs, rdsym(fd, tr));
+ for (i = 0; i < n; i++) {
+ fn = rdsym(fd, tr);
+ fn->decl.impls = mkht(tyhash, tyeq);
+ lappend(&tr->funcs, &tr->nfuncs, fn);
+ }
htput(trmap, itop(uid), tr);
return tr;
}
@@ -963,7 +967,6 @@ foundextlib:
puttrait(s, tr->name, tr);
for (i = 0; i < tr->nfuncs; i++) {
putdcl(s, tr->funcs[i]);
- tr->funcs[i]->decl.impls = mkht(tyhash, tyeq);
}
}
break;
@@ -1131,6 +1134,8 @@ void writeuse(FILE *f, Node *file)
}
for (i = 0; i < ntraittab; i++) {
+ if (i < Ntraits)
+ continue;
if (traittab[i]->vis == Visexport || traittab[i]->vis == Vishidden) {
wrbyte(f, 'R');
traitpickle(f, traittab[i]);