ref: b5c63138b4f40766dacc40e8ce91d44abdbb3b0e
parent: f698f29852c65149698e6018f2c5d312cf9b2812
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Jan 17 06:43:15 EST 2018
Fix init funcion symtab linking
--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -649,7 +649,6 @@
name = mkname(Zloc, "__init__");
decl = mkdecl(Zloc, name, mktyvar(Zloc));
block = mkblock(Zloc, mkstab(0));
- block->block.scope->super = file->file.globls;
tyvoid = mktype(Zloc, Tyvoid);
tyvoidfn = mktyfunc(Zloc, NULL, 0, tyvoid);
@@ -661,7 +660,6 @@
callinit(block, file->file.localinit, tyvoid, tyvoidfn);
func = mkfunc(Zloc, NULL, 0, mktype(Zloc, Tyvoid), block);
- func->expr.type = tyvoidfn;
init = mkexpr(Zloc, Olit, func, NULL);
init->expr.type = tyvoidfn;
@@ -670,6 +668,9 @@
decl->decl.isglobl = 1;
decl->decl.type = tyvoidfn;
decl->decl.vis = Vishidden;
+
+ func->lit.fnval->func.scope->super = file->file.globls;
+ block->block.scope->super = func->lit.fnval->func.scope->super;
lappend(&file->file.stmts, &file->file.nstmts, decl);
}