ww: implement package initialization
This commit is contained in:
@@ -3,8 +3,9 @@ package wcc;
|
||||
import syntax;
|
||||
|
||||
export fn compilefile(file: *syntax.node, testmode: i32, testpackage: i32,
|
||||
testmodule: str, testtarget: str, sepmode: i32, wwiout: str,
|
||||
entrymode: i32) i32 = {
|
||||
testmodule: str, testtarget: str, sepmode: i32, wwifd: i32,
|
||||
haswwi: i32,
|
||||
entrymode: i32, packageinitsymbol: str, initdispatchsymbol: str) i32 = {
|
||||
let tc: syntax.tctx;
|
||||
syntax.typesinit(&tc);
|
||||
let ck: checker;
|
||||
@@ -14,18 +15,19 @@ export fn compilefile(file: *syntax.node, testmode: i32, testpackage: i32,
|
||||
if (testmodule.len > 0) { ck.testmodule = testmodule; };
|
||||
ck.testtarget = testtarget;
|
||||
ck.sepmode = sepmode;
|
||||
ck.packageinitsymbol = packageinitsymbol;
|
||||
checkfile(&ck, file);
|
||||
if (ck.errs > 0) { return 1; };
|
||||
if (wwiout.len > 0) {
|
||||
if (wwiemit(&ck, file, wwiout) != 0) { return 1; };
|
||||
if (haswwi != 0) {
|
||||
if (wwiemitfd(&ck, file, wwifd) != 0) { return 1; };
|
||||
};
|
||||
|
||||
let cg: cgen;
|
||||
cgeninit(&cg);
|
||||
cg.sepmode = sepmode;
|
||||
if (wwiout.len > 0 && entrymode == 0) { cg.sepisdep = 1i32; };
|
||||
cgfile(&cg, file);
|
||||
return 0;
|
||||
if (haswwi != 0 && entrymode == 0) { cg.sepisdep = 1i32; };
|
||||
cg.initdispatchsymbol = initdispatchsymbol;
|
||||
return cgfile(&cg, file);
|
||||
};
|
||||
|
||||
export fn resolvefile(file: *syntax.node, verbose: i32,
|
||||
|
||||
Reference in New Issue
Block a user