Experiment with different uses of -use-separate-modules

This commit is contained in:
gingerBill
2024-07-08 14:48:59 +01:00
parent 7dd4cccce7
commit 8491e2491c
4 changed files with 23 additions and 13 deletions

View File

@@ -120,23 +120,22 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
if (USE_SEPARATE_MODULES) {
for (auto const &entry : gen->info->packages) {
AstPackage *pkg = entry.value;
#if 1
auto m = gb_alloc_item(permanent_allocator(), lbModule);
m->pkg = pkg;
m->gen = gen;
map_set(&gen->modules, cast(void *)pkg, m);
lb_init_module(m, c);
#else
// NOTE(bill): Probably per file is not a good idea, so leave this for later
for (AstFile *file : pkg->files) {
auto m = gb_alloc_item(permanent_allocator(), lbModule);
m->file = file;
m->pkg = pkg;
m->gen = gen;
map_set(&gen->modules, cast(void *)file, m);
lb_init_module(m, c);
if (build_context.module_per_file) {
// NOTE(bill): Probably per file is not a good idea, so leave this for later
for (AstFile *file : pkg->files) {
auto m = gb_alloc_item(permanent_allocator(), lbModule);
m->file = file;
m->pkg = pkg;
m->gen = gen;
map_set(&gen->modules, cast(void *)file, m);
lb_init_module(m, c);
}
}
#endif
}
}