| ... | ... | @@ -2302,7 +2302,7 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void { |
| 2302 | 2302 | try pt.processExports(); |
| 2303 | 2303 | } |
| 2304 | 2304 | |
| 2305 | | if (try comp.totalErrorCount() != 0) { |
| 2305 | if (anyErrors(comp)) { |
| 2306 | 2306 | // Skip flushing and keep source files loaded for error reporting. |
| 2307 | 2307 | comp.link_error_flags = .{}; |
| 2308 | 2308 | return; |
| ... | ... | @@ -2392,6 +2392,10 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void { |
| 2392 | 2392 | .sub_path = o_sub_path, |
| 2393 | 2393 | }, .main, main_progress_node); |
| 2394 | 2394 | |
| 2395 | // Calling `flush` may have produced errors, in which case the |
| 2396 | // cache manifest must not be written. |
| 2397 | if (anyErrors(comp)) return; |
| 2398 | |
| 2395 | 2399 | // Failure here only means an unnecessary cache miss. |
| 2396 | 2400 | man.writeManifest() catch |err| { |
| 2397 | 2401 | log.warn("failed to write cache manifest: {s}", .{@errorName(err)}); |
| ... | ... | @@ -3291,6 +3295,10 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { |
| 3291 | 3295 | return bundle.toOwnedBundle(compile_log_text); |
| 3292 | 3296 | } |
| 3293 | 3297 | |
| 3298 | fn anyErrors(comp: *Compilation) bool { |
| 3299 | return (totalErrorCount(comp) catch return true) != 0; |
| 3300 | } |
| 3301 | |
| 3294 | 3302 | fn totalErrorCount(comp: *Compilation) !u32 { |
| 3295 | 3303 | var errors = try comp.getAllErrorsAlloc(); |
| 3296 | 3304 | defer errors.deinit(comp.gpa); |