| ... | @@ -8505,10 +8505,8 @@ static ZigType *add_special_code(CodeGen *g, ZigPackage *package, const char *ba | ... | @@ -8505,10 +8505,8 @@ static ZigType *add_special_code(CodeGen *g, ZigPackage *package, const char *ba |
| 8505 | return add_source_file(g, package, resolved_path, import_code, SourceKindPkgMain); | 8505 | return add_source_file(g, package, resolved_path, import_code, SourceKindPkgMain); |
| 8506 | } | 8506 | } |
| 8507 | | 8507 | |
| 8508 | static ZigPackage *create_bootstrap_pkg(CodeGen *g, ZigPackage *pkg_with_main) { | 8508 | static ZigPackage *create_bootstrap_pkg(CodeGen *g) { |
| 8509 | ZigPackage *package = codegen_create_package(g, buf_ptr(g->zig_std_special_dir), "bootstrap.zig", "std.special"); | 8509 | return codegen_create_package(g, buf_ptr(g->zig_std_special_dir), "bootstrap.zig", "std.special"); |
| 8510 | package->package_table.put(buf_create_from_str("@root"), pkg_with_main); | | |
| 8511 | return package; | | |
| 8512 | } | 8510 | } |
| 8513 | | 8511 | |
| 8514 | static ZigPackage *create_test_runner_pkg(CodeGen *g) { | 8512 | static ZigPackage *create_test_runner_pkg(CodeGen *g) { |
| ... | @@ -8632,12 +8630,12 @@ static void gen_root_source(CodeGen *g) { | ... | @@ -8632,12 +8630,12 @@ static void gen_root_source(CodeGen *g) { |
| 8632 | !g->have_c_main && !g->have_winmain && !g->have_winmain_crt_startup && | 8630 | !g->have_c_main && !g->have_winmain && !g->have_winmain_crt_startup && |
| 8633 | ((g->have_pub_main && g->out_type == OutTypeObj) || g->out_type == OutTypeExe)) | 8631 | ((g->have_pub_main && g->out_type == OutTypeObj) || g->out_type == OutTypeExe)) |
| 8634 | { | 8632 | { |
| 8635 | g->bootstrap_import = add_special_code(g, create_bootstrap_pkg(g, g->root_package), "bootstrap.zig"); | 8633 | g->bootstrap_import = add_special_code(g, create_bootstrap_pkg(g), "bootstrap.zig"); |
| 8636 | } | 8634 | } |
| 8637 | if (g->zig_target->os == OsWindows && !g->have_dllmain_crt_startup && | 8635 | if (g->zig_target->os == OsWindows && !g->have_dllmain_crt_startup && |
| 8638 | g->out_type == OutTypeLib && g->is_dynamic) | 8636 | g->out_type == OutTypeLib && g->is_dynamic) |
| 8639 | { | 8637 | { |
| 8640 | g->bootstrap_import = add_special_code(g, create_bootstrap_pkg(g, g->root_package), "bootstrap_lib.zig"); | 8638 | g->bootstrap_import = add_special_code(g, create_bootstrap_pkg(g), "bootstrap_lib.zig"); |
| 8641 | } | 8639 | } |
| 8642 | | 8640 | |
| 8643 | if (!g->error_during_imports) { | 8641 | if (!g->error_during_imports) { |
| ... | @@ -8645,7 +8643,7 @@ static void gen_root_source(CodeGen *g) { | ... | @@ -8645,7 +8643,7 @@ static void gen_root_source(CodeGen *g) { |
| 8645 | } | 8643 | } |
| 8646 | if (g->is_test_build) { | 8644 | if (g->is_test_build) { |
| 8647 | create_test_compile_var_and_add_test_runner(g); | 8645 | create_test_compile_var_and_add_test_runner(g); |
| 8648 | g->bootstrap_import = add_special_code(g, create_bootstrap_pkg(g, g->test_runner_package), "bootstrap.zig"); | 8646 | g->bootstrap_import = add_special_code(g, create_bootstrap_pkg(g), "bootstrap.zig"); |
| 8649 | | 8647 | |
| 8650 | if (!g->error_during_imports) { | 8648 | if (!g->error_during_imports) { |
| 8651 | semantic_analyze(g); | 8649 | semantic_analyze(g); |
| ... | @@ -9629,6 +9627,13 @@ ZigPackage *codegen_create_package(CodeGen *g, const char *root_src_dir, const c | ... | @@ -9629,6 +9627,13 @@ ZigPackage *codegen_create_package(CodeGen *g, const char *root_src_dir, const c |
| 9629 | if (g->std_package != nullptr) { | 9627 | if (g->std_package != nullptr) { |
| 9630 | assert(g->compile_var_package != nullptr); | 9628 | assert(g->compile_var_package != nullptr); |
| 9631 | pkg->package_table.put(buf_create_from_str("std"), g->std_package); | 9629 | pkg->package_table.put(buf_create_from_str("std"), g->std_package); |
| | 9630 | |
| | 9631 | if (g->is_test_build) { |
| | 9632 | pkg->package_table.put(buf_create_from_str("@root"), g->test_runner_package); |
| | 9633 | } else { |
| | 9634 | pkg->package_table.put(buf_create_from_str("@root"), g->root_package); |
| | 9635 | } |
| | 9636 | |
| 9632 | pkg->package_table.put(buf_create_from_str("builtin"), g->compile_var_package); | 9637 | pkg->package_table.put(buf_create_from_str("builtin"), g->compile_var_package); |
| 9633 | } | 9638 | } |
| 9634 | return pkg; | 9639 | return pkg; |