wcc/ww: tag sep-built dotted-path packages by full path not leaf (#57)
A separately-compiled package's primary body was emitted under a bare `//ww:module-reset`, so its own `package <leaf>;` clause set curmod to the leaf (e.g. utf8) while the importer spliced the .wwi under the full `//ww:module encoding.utf8` — definer mangled `utf8.X`, importer wanted `encoding.utf8.X`, unresolved. Thread the dotted path through the directive: `//ww:module-reset <path>` sets curmod to the dotted path (imported stays 0, so the root `fn main` stays bare per #32), and the body's package clause is demoted to a leaf==last-component assertion instead of overwriting curmod. Aligns sep-build to the M1 path-mangle model; only the SEP emitter changes (the combined build_one arm is untouched, so all combined byte-id gates hold). Both stages mirrored. Commit-6 broad-soak prerequisite. Gate 989_sepdotpath_run sep-builds a 2-level dotted package and proves definer==importer qualification + single-component non-vacuity, cs==ww.
This commit is contained in:
10
cmd/wcc/ww.h
10
cmd/wcc/ww.h
@@ -221,6 +221,10 @@ struct Lex {
|
||||
const char *modpath; /* a `//ww:module <path>` directive was seen in
|
||||
* the last skipped run; lexnext emits TK_MODPATH
|
||||
* carrying this dotted path (M1 #22). */
|
||||
const char *modresetpath; /* a `//ww:module-reset <path>` directive
|
||||
* was seen; the next TK_MODRESET carries this
|
||||
* dotted path so the sep primary body mangles
|
||||
* on the path, not its leaf clause (#57). */
|
||||
};
|
||||
|
||||
void lexinit(Lex*, Arena*, const char *file, const char *src, u64 len);
|
||||
@@ -379,6 +383,12 @@ struct Parser {
|
||||
* import path; while set, decls stamp
|
||||
* module=pathmod and imported=1, and the
|
||||
* in-file `package` clause is an assertion. */
|
||||
const char *resetmod; /* #57: active `//ww:module-reset <path>` dotted
|
||||
* path; mangles decls on the path WITHOUT
|
||||
* imported=1 (primary-ness for -c and the #32
|
||||
* bare-main rule stay intact), and the in-file
|
||||
* `package` clause asserts (leaf == last
|
||||
* component) instead of overwriting curmod. */
|
||||
};
|
||||
|
||||
void parserinit(Parser*, Arena*, Lex*);
|
||||
|
||||
Reference in New Issue
Block a user