ref: 4770743d640a13ae81110b4161f0eb6eff9c0be1
parent: 50fe381eba833d4bbeaa3cc634b87c2d211df79f
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Oct 18 19:19:22 EDT 2017
Look up the proto before attaching the gimpls. This means we don't lose the gimpls when they come from a file other than the one they're implemented in.
--- a/parse/use.c
+++ b/parse/use.c
@@ -857,6 +857,7 @@
dclname = declname(dcl);
for (i = 0; i < tr->nproto; i++) {
proto = tr->proto[i];
+ proto = getdcl(curstab(), proto->decl.name);
protoname = declname(proto);
len = strlen(protoname);
p = strstr(dclname, protoname);
@@ -996,12 +997,11 @@
break;
case 'R':
tr = traitunpickle(f);
- if (!tr->ishidden) {
- tr->vis = vis;
- puttrait(s, tr->name, tr);
- for (i = 0; i < tr->nproto; i++) {
- putdcl(s, tr->proto[i]);
- }
+ tr->vis = vis;
+ puttrait(s, tr->name, tr);
+ for (i = 0; i < tr->nproto; i++) {
+ putdcl(s, tr->proto[i]);
+ tr->proto[i]->decl.ishidden = tr->ishidden;
}
break;
case 'T':
@@ -1043,7 +1043,6 @@
}
fixtypemappings(s);
fixtraitmappings(s);
- fiximplmappings(s);
htfree(tidmap);
for (i = starttype; i < ntypes; i++) {
ty = types[i];
@@ -1075,6 +1074,7 @@
bindtype(impl->impl.env, impl->impl.type);
}
}
+ fiximplmappings(s);
popstab();
return 1;
}