ref: f6187a0b64f4b48d8d710ae99c7738e72a6de42d
parent: ee8b865d1f3b71a0fdd91025ba5bc4813e63bd17
author: Ori Bernstein <[email protected]>
date: Mon Dec 16 10:10:03 EST 2013
Install specialized declarations before fixup() Fixup can call specializedcl(). If we don't insert the decl into our namespace, we end up with a problem, since we can end up recursing infinitely within specializedcl when we have a recursive function call. This solves the problem.
--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -65,7 +65,7 @@
htput(tsmap, t, ret);
for (i = 0; i < t->nparam; i++)
lappend(&ret->arg, &ret->narg, tyspecialize(t->param[i], tsmap));
- ret->isgeneric = hasparams(ret);
+ ret->isgeneric = hasparams(ret);
}
break;
case Tystruct:
@@ -401,9 +401,10 @@
d->decl.isconst = n->decl.isconst;
d->decl.isextern = n->decl.isextern;
d->decl.init = specializenode(n->decl.init, tsmap);
+ putdcl(file->file.globls, d);
+
fixup(d);
- putdcl(file->file.globls, d);
lappend(&file->file.stmts, &file->file.nstmts, d);
if (d->decl.name->name.ns)
popstab();