Skip to content

Commit 093e5ee

Browse files
authored
Merge pull request #871 from ahoppen/ahoppen/no-diagnostics-if-no-error
Skip subtrees that don’t contain any errors during diagnostic generation
2 parents b1c437d + d4ed127 commit 093e5ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/SwiftParser/Diagnostics/ParseDiagnosticsGenerator.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
8989
/// Whether the node should be skipped for diagnostic emission.
9090
/// Every visit method must check this at the beginning.
9191
func shouldSkip<T: SyntaxProtocol>(_ node: T) -> Bool {
92+
if !node.hasError {
93+
return true
94+
}
9295
return handledNodes.contains(node.id)
9396
}
9497

0 commit comments

Comments
 (0)