compiler: load imports and enforce package exports
This commit is contained in:
@@ -77,6 +77,7 @@ main(int argc, char **argv)
|
||||
|
||||
check_init(&c, a);
|
||||
c.is_test = testmode;
|
||||
c.sep_mode = sepmode;
|
||||
check_file(&c, file);
|
||||
if (c.errs) return 1;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user