aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-11-09 20:51:09 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-11-09 20:51:09 -0700
commit06a3a69e6f38798b1768976520b8db40c9a210bf (patch)
tree44800cb3ddff185ca478f13b715121124c1a6971 /src
parent73f3f0167079aaa47117175c31960963dc5af9ee (diff)
downloadzig-06a3a69e6f38798b1768976520b8db40c9a210bf.tar.gz
zig-06a3a69e6f38798b1768976520b8db40c9a210bf.zip
main: updateModule returns an error when there are any compile errors
closes #6976
Diffstat (limited to 'src')
-rw-r--r--src/main.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig
index 7df8cb1eda..0520724f73 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1707,7 +1707,10 @@ fn buildOutputType(
}
};
- try updateModule(gpa, comp, zir_out_path, hook);
+ updateModule(gpa, comp, zir_out_path, hook) catch |err| switch (err) {
+ error.SemanticAnalyzeFail => process.exit(1),
+ else => |e| return e,
+ };
if (build_options.is_stage1 and comp.stage1_lock != null and watch) {
warn("--watch is not recommended with the stage1 backend; it leaks memory and is not capable of incremental compilation", .{});
@@ -1819,7 +1822,10 @@ fn buildOutputType(
if (output_mode == .Exe) {
try comp.makeBinFileWritable();
}
- try updateModule(gpa, comp, zir_out_path, hook);
+ updateModule(gpa, comp, zir_out_path, hook) catch |err| switch (err) {
+ error.SemanticAnalyzeFail => continue,
+ else => |e| return e,
+ };
} else if (mem.eql(u8, actual_line, "exit")) {
break;
} else if (mem.eql(u8, actual_line, "help")) {
@@ -1849,6 +1855,7 @@ fn updateModule(gpa: *Allocator, comp: *Compilation, zir_out_path: ?[]const u8,
for (errors.list) |full_err_msg| {
full_err_msg.renderToStdErr();
}
+ return error.SemanticAnalyzeFail;
} else switch (hook) {
.none => {},
.print => |bin_path| try io.getStdOut().writer().print("{s}\n", .{bin_path}),