Skip to content

Commit d4ed127

Browse files
committed
Skip subtrees that don’t contain any errors during diagnostic generation
If a subtree doesn’t contain an error, we don’t need to walk it for diagnostics generation.
1 parent 2a65025 commit d4ed127

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
@@ -65,6 +65,9 @@ public class ParseDiagnosticsGenerator: SyntaxAnyVisitor {
6565
/// Whether the node should be skipped for diagnostic emission.
6666
/// Every visit method must check this at the beginning.
6767
func shouldSkip<T: SyntaxProtocol>(_ node: T) -> Bool {
68+
if !node.hasError {
69+
return true
70+
}
6871
return handledNodes.contains(node.id)
6972
}
7073

0 commit comments

Comments
 (0)