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

@@ -3245,13 +3245,17 @@ check_file(Checker *c, Node *file)
* already emits the qualified call. wwstage twin in check.ww. */
if (c->is_test) {
int present = 0;
/* The synthetic runner belongs to file->sourceid. An import in an
* earlier module-reset section neither supplies nor uses its binding. */
for (Node *u = file->list; u; u = u->next) {
if (c->test_target != NULL && u->kind == N_USE
&& !u->imported && u->usepath
&& !u->imported && u->sourceid == file->sourceid
&& u->usepath
&& (strcmp(u->usepath, c->test_target) == 0
|| strcmp(u->usepath, c->test_module) == 0))
u->used = 1;
if (u->kind == N_USE && !u->imported
&& u->sourceid == file->sourceid
&& u->usepath && strcmp(u->usepath, c->test_module) == 0) {
present = 1;
}