aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2021-04-05 22:50:54 +0200
committerTimon Kruiper <timonkruiper@gmail.com>2021-04-08 14:23:18 +0200
commitac14b52e85f857f7f70846d22ea18ea265acb91a (patch)
treebceefa15a211ba323fe7645dd69ab6b768f59555 /src/main.zig
parente85cd616ef6439fdb9e7ac118251bb7c2296e553 (diff)
downloadzig-ac14b52e85f857f7f70846d22ea18ea265acb91a.tar.gz
zig-ac14b52e85f857f7f70846d22ea18ea265acb91a.zip
stage2: add support for start.zig
This adds a simplified start2.zig that the current stage2 compiler is able to generate code for.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig
index 5fb74db61f..0f03813a36 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1732,6 +1732,8 @@ fn buildOutputType(
},
}
+ // This gets cleaned up, because root_pkg becomes part of the
+ // package table of the start_pkg.
const root_pkg: ?*Package = if (root_src_file) |src_path| blk: {
if (main_pkg_path) |p| {
const rel_src_path = try fs.path.relative(gpa, p, src_path);
@@ -1741,7 +1743,6 @@ fn buildOutputType(
break :blk try Package.create(gpa, fs.path.dirname(src_path), fs.path.basename(src_path));
}
} else null;
- defer if (root_pkg) |p| p.destroy(gpa);
// Transfer packages added with --pkg-begin/--pkg-end to the root package
if (root_pkg) |pkg| {