aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-15 21:20:06 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-15 21:20:06 -0700
commit7cd94d212361bc5662e8cc6959cd32edca1df03a (patch)
tree7a5fe6aa6a2da5c6f160659c8b8894a93662d953 /src/Compilation.zig
parentdc036f5b6fde67c4a74701c75c5947a956abaec1 (diff)
downloadzig-7cd94d212361bc5662e8cc6959cd32edca1df03a.tar.gz
zig-7cd94d212361bc5662e8cc6959cd32edca1df03a.zip
stage2: omit Decl compile errors from failed AstGen files
Just like when new parse errors occur during an update, when new AstGen errors occur during an update, we do not reveal compile errors for Decl objects which are inside of a newly failed File. Once the File passes AstGen successfully, it will be compared with the previously succeeded ZIR and the saved Decl compile errors will be handled properly.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index ac26b89926..6e6fab5cc2 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1696,17 +1696,15 @@ pub fn totalErrorCount(self: *Compilation) usize {
// the previous parse success, including compile errors, but we cannot
// emit them until the file succeeds parsing.
for (module.failed_decls.items()) |entry| {
- if (entry.key.namespace.file_scope.status == .parse_failure) {
- continue;
+ if (entry.key.namespace.file_scope.okToReportErrors()) {
+ total += 1;
}
- total += 1;
}
if (module.emit_h) |emit_h| {
for (emit_h.failed_decls.items()) |entry| {
- if (entry.key.namespace.file_scope.status == .parse_failure) {
- continue;
+ if (entry.key.namespace.file_scope.okToReportErrors()) {
+ total += 1;
}
- total += 1;
}
}
}
@@ -1767,21 +1765,19 @@ pub fn getAllErrorsAlloc(self: *Compilation) !AllErrors {
}
}
for (module.failed_decls.items()) |entry| {
- if (entry.key.namespace.file_scope.status == .parse_failure) {
- // Skip errors for Decls within files that had a parse failure.
- // We'll try again once parsing succeeds.
- continue;
+ // Skip errors for Decls within files that had a parse failure.
+ // We'll try again once parsing succeeds.
+ if (entry.key.namespace.file_scope.okToReportErrors()) {
+ try AllErrors.add(module, &arena, &errors, entry.value.*);
}
- try AllErrors.add(module, &arena, &errors, entry.value.*);
}
if (module.emit_h) |emit_h| {
for (emit_h.failed_decls.items()) |entry| {
- if (entry.key.namespace.file_scope.status == .parse_failure) {
- // Skip errors for Decls within files that had a parse failure.
- // We'll try again once parsing succeeds.
- continue;
+ // Skip errors for Decls within files that had a parse failure.
+ // We'll try again once parsing succeeds.
+ if (entry.key.namespace.file_scope.okToReportErrors()) {
+ try AllErrors.add(module, &arena, &errors, entry.value.*);
}
- try AllErrors.add(module, &arena, &errors, entry.value.*);
}
}
for (module.failed_exports.items()) |entry| {