compiler: load imports and enforce package exports

This commit is contained in:
2026-08-11 22:25:59 +09:00
parent 7bc96b4e03
commit db96422f74
14 changed files with 894 additions and 118 deletions

View File

@@ -543,8 +543,13 @@ wwi_emit(Checker *c, FILE *of, Node *file)
k++;
}
qsort(us, (size_t)nuse, sizeof *us, usecmp);
for (int i = 0; i < nuse; i++)
const char *previous = NULL;
for (int i = 0; i < nuse; i++) {
if (previous && strcmp(previous, us[i].path) == 0)
continue;
fprintf(of, "import %s;\n", us[i].path);
previous = us[i].path;
}
free(us);
}