ref: 090d441a579249de5256c02a49bef1cd21104721
parent: e4a027e5963bfc5b383677519562d1d4c88bbb13
author: Ori Bernstein <[email protected]>
date: Wed Jul 25 18:01:55 EDT 2012
Work towards making generic imports get specialized.
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -465,6 +465,11 @@
settype(st, var, freshen(st, s->decl.type));
else
settype(st, var, s->decl.type);
+ if (s->decl.isgeneric) {
+ lappend(&st->specializationscope, &st->nspecializationscope, curstab());
+ lappend(&st->specializations, &st->nspecializations, var);
+ lappend(&st->genericdecls, &st->ngenericdecls, s);
+ }
*ret = var;
}
@@ -771,8 +776,9 @@
if (d->type == Ndecl) {
s = getdcl(file->file.exports, d->decl.name);
if (s) {
- s->decl.isexport = 1;
d->decl.isexport = 1;
+ s->decl.isexport = 1;
+ s->decl.init = d->decl.init;
unify(st, d, type(st, d), s->decl.type);
}
}
--- a/parse/pickle.c
+++ b/parse/pickle.c
@@ -377,6 +377,7 @@
pickle(n->decl.init, fd);
break;
case Nfunc:
+ wrtype(fd, n->func.type);
wrstab(fd, n->func.scope);
wrint(fd, n->func.nargs);
for (i = 0; i < n->func.nargs; i++)
@@ -496,6 +497,7 @@
n->decl.init = unpickle(fd);
break;
case Nfunc:
+ n->func.type = rdtype(fd);
n->func.scope = rdstab(fd);
n->func.nargs = rdint(fd);
n->func.args = xalloc(sizeof(Node *)*n->func.nargs);