compiler: separate package exports from entry roots

This commit is contained in:
2026-08-12 21:59:51 +09:00
parent a88078faf8
commit fc4bde703e
15 changed files with 420 additions and 190 deletions

View File

@@ -2,13 +2,14 @@ package wcc;
import syntax;
export fn compilefile(file: *syntax.node, testmode: i32, testmodule: str,
sepmode: i32, wwiout: str) i32 = {
export fn compilefile(file: *syntax.node, testmode: i32, testpackage: i32,
testmodule: str, sepmode: i32, wwiout: str, entrymode: i32) i32 = {
let tc: syntax.tctx;
syntax.typesinit(&tc);
let ck: checker;
checkinit(&ck, &tc);
ck.istest = testmode;
ck.istestpackage = testpackage;
if (testmodule.len > 0) { ck.testmodule = testmodule; };
ck.sepmode = sepmode;
checkfile(&ck, file);
@@ -20,7 +21,7 @@ export fn compilefile(file: *syntax.node, testmode: i32, testmodule: str,
let cg: cgen;
cgeninit(&cg);
cg.sepmode = sepmode;
if (wwiout.len > 0) { cg.sepisdep = 1i32; };
if (wwiout.len > 0 && entrymode == 0) { cg.sepisdep = 1i32; };
cgfile(&cg, file);
return 0;
};