ref: 2b1cb19f0bcf63320701a5ad9815c326cf40e34c
parent: 481445dc78bd2bbc733acfaf3f10ad0b8b4b2441
author: Ori Bernstein <[email protected]>
date: Mon Feb 24 16:33:38 EST 2014
Fix up visibility and merging of traits.
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -292,6 +292,7 @@
}
| traitdef {
size_t i;
+ $1->vis = Visexport;
puttrait(file->file.exports, $1->name, $1);
for (i = 0; i < $1->nfuncs; i++)
putdcl(file->file.exports, $1->funcs[i]);
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -838,6 +838,7 @@
fatal(nx->line, "Exported type %s not declared", namestr(nx));
}
}
+ trx->vis = Visexport;
}
free(k);
--- a/parse/type.c
+++ b/parse/type.c
@@ -116,6 +116,7 @@
Trait *t;
t = zalloc(sizeof(Trait));
+ t->vis = Visintern;
t->name = name;
t->param = param;
t->memb = memb;
--- a/parse/use.c
+++ b/parse/use.c
@@ -170,7 +170,7 @@
n->decl.istraitfn = rdbool(fd);
- if (n->decl.isgeneric)
+ if (n->decl.isgeneric && !n->decl.istraitfn)
n->decl.init = unpickle(fd);
return n;
}
@@ -248,7 +248,7 @@
}
}
- void traitpickle(FILE *fd, Trait *tr)
+static void traitpickle(FILE *fd, Trait *tr)
{
die("Trait pickling not yet implemented");
}
@@ -835,7 +835,7 @@
typickle(f, types[i]);
}
}
- /*
+
for (i = 0; i < ntraittab; i++) {
if (traittab[i]->vis == Visexport || traittab[i]->vis == Vishidden) {
wrbyte(f, 'R');
@@ -842,7 +842,7 @@
traitpickle(f, traittab[i]);
}
}
- */
+
k = htkeys(st->dcl, &n);
for (i = 0; i < n; i++) {
s = getdcl(st, k[i]);