stage2: add support for start.zig

This adds a simplified start2.zig that the current stage2 compiler is
able to generate code for.
This commit is contained in:
Timon Kruiper
2021-04-05 22:50:54 +02:00
parent e85cd616ef
commit ac14b52e85
6 changed files with 136 additions and 34 deletions

View File

@@ -35,8 +35,11 @@ comp: *Compilation,
zig_cache_artifact_directory: Compilation.Directory,
/// Pointer to externally managed resource. `null` if there is no zig file being compiled.
root_pkg: *Package,
/// This is populated when `@import("root")` is analysed.
root_scope: ?*Scope.File,
start_pkg: *Package,
/// Module owns this resource.
root_scope: *Scope.File,
start_scope: *Scope.File,
/// It's rare for a decl to be exported, so we save memory by having a sparse map of
/// Decl pointers to details about them being exported.
/// The Export memory is owned by the `export_owners` table; the slice itself is owned by this table.
@@ -2341,7 +2344,9 @@ pub fn deinit(mod: *Module) void {
mod.export_owners.deinit(gpa);
mod.symbol_exports.deinit(gpa);
mod.root_scope.destroy(gpa);
mod.start_scope.destroy(gpa);
mod.start_pkg.destroy(gpa);
var it = mod.global_error_set.iterator();
while (it.next()) |entry| {