summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-01-17 11:43:15 -0800
committerOri Bernstein <ori@markovcorp.com>2018-01-17 11:43:15 -0800
commitb5c63138b4f40766dacc40e8ce91d44abdbb3b0e (patch)
treea7b6d7442f59ba015f360f1143b1881c3fdeb39f
parentf698f29852c65149698e6018f2c5d312cf9b2812 (diff)
downloadmc-b5c63138b4f40766dacc40e8ce91d44abdbb3b0e.tar.gz
Fix init funcion symtab linking
-rw-r--r--parse/specialize.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/parse/specialize.c b/parse/specialize.c
index 0491d76..9088250 100644
--- a/parse/specialize.c
+++ b/parse/specialize.c
@@ -649,7 +649,6 @@ geninit(void)
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 @@ geninit(void)
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;
@@ -671,5 +669,8 @@ geninit(void)
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);
}