ww: keep generated test support file-scoped

This commit is contained in:
2026-08-14 04:20:29 +09:00
parent 9b015e764c
commit 695983f7c3
5 changed files with 85 additions and 34 deletions

View File

@@ -7655,15 +7655,18 @@ fn checkfile(c: *checker, file: *syntax.node) void = {
// cstage cmd/wcc/check.c.
if (c.istest != 0) {
let present: bool = false;
// The synthetic runner belongs to file.sourceid. An import in an
// earlier module-reset section neither supplies nor uses its binding.
let su: *syntax.node = file.list;
for (su != nil) {
if (c.testtarget.len > 0 && su.kind == syntax.nkind.N_USE
&& su.imported == 0
&& su.imported == 0 && su.sourceid == file.sourceid
&& (syntax.streq(su.usepath, c.testtarget)
|| syntax.streq(su.usepath, c.testmodule))) {
su.used = 1i32;
};
if (su.kind == syntax.nkind.N_USE && su.imported == 0
&& su.sourceid == file.sourceid
&& syntax.streq(su.usepath, c.testmodule)) {
present = true;
};