authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-22 16:14:03-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-06-23 10:44:46-07:00
logaf40e3f54c12857bb5ac541f8a3e1a9b5f93a626
treeaf18a563b1ef1155e893555945b3b45d14b243b3
parent150515f44db9cecbda31d579861dc6f6080c2f75

stage2: glue code to AstGen root source file when using stage1

Normally we rely on importing std to in turn import the root in the start code, but when using the stage1 won't happen, so in order to run AstGen on the root we put it into the import_table here.

1 files changed, 8 insertions(+), 0 deletions(-)

src/Compilation.zig+8
......@@ -1639,6 +1639,14 @@ pub fn update(self: *Compilation) !void {
16391639 const std_pkg = module.root_pkg.table.get("std").?;
16401640 _ = try module.importPkg(std_pkg);
16411641
1642 // Normally we rely on importing std to in turn import the root source file
1643 // in the start code, but when using the stage1 backend that won't happen,
1644 // so in order to run AstGen on the root source file we put it into the
1645 // import_table here.
1646 if (use_stage1) {
1647 _ = try module.importPkg(module.root_pkg);
1648 }
1649
16421650 // Put a work item in for every known source file to detect if
16431651 // it changed, and, if so, re-compute ZIR and then queue the job
16441652 // to update it.