compiler: separate package exports from entry roots
This commit is contained in:
@@ -502,10 +502,8 @@ type cgen = struct {
|
||||
// like strlits/ffis. Symmetric with cstage Cg.sep_mode.
|
||||
sepmode: i32,
|
||||
// #99: this unit is a sep DEPENDENCY, not the root/link-entry unit.
|
||||
// Set from `wwiout != nil` in main — the producer passes -I (.wwi
|
||||
// output) to DEP units only; the root's .wwi is stripped (#69), so
|
||||
// wwiout==nil <=> root/link-entry unit. Gates the bare-`main` carve-
|
||||
// out: a dep's `fn main` mangles on its path like any decl; only the
|
||||
// The explicit entry mode is independent of `.wwi` production. It gates
|
||||
// the bare-`main` carve-out: a dep's `fn main` mangles like any decl; only the
|
||||
// root entry stays bare. Like sepmode, NOT reset by cgeninit (per-fn).
|
||||
// Symmetric with cstage Cg.sep_isdep.
|
||||
sepisdep: i32,
|
||||
@@ -3810,8 +3808,8 @@ fn collectmods(c: *cgen, file: *syntax.node) void = {
|
||||
// #99: under sep a dep unit's main is imported==0 too (its
|
||||
// body is composed with a path-carrying `//ww:module-reset`,
|
||||
// #57), so imported==0 no longer means "root unit" per-unit.
|
||||
// sepisdep (wwiout==nil <=> root/link-entry unit, #69)
|
||||
// re-mangles a dep's main; only the root's stays bare.
|
||||
// Explicit entry mode clears sepisdep independently of export
|
||||
// production; every other package's main remains mangled.
|
||||
if (!syntax.streq(d.str, "main") || d.imported != 0 || c.sepisdep != 0) {
|
||||
let m: *modent = alloc(modent{mname=d.str, nmod=d.nmod, omod=d.nmod, mnext=c.mods})!;
|
||||
c.mods = m;
|
||||
|
||||
Reference in New Issue
Block a user