-
Notifications
You must be signed in to change notification settings - Fork 441
Add a recursive hasError
flag to RawSyntax
#596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Sources/SwiftSyntax/RawSyntax.swift
Outdated
@@ -172,6 +174,13 @@ extension RawSyntax { | |||
kind.isUnknown | |||
} | |||
|
|||
var hasError: Bool { | |||
switch rawData.payload { | |||
case .materializedToken(_): return self.presence == .missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to detect the presence of the node purely based on the materializedToken
but I’m worried that will break if we change whether tokens without source text but with trivia are considered missing.
@swift-ci Please test |
I realized that we might need/want this flag in |
@swift-ci Please test |
@@ -172,6 +187,19 @@ extension RawSyntax { | |||
kind.isUnknown | |||
} | |||
|
|||
var recursiveFlags: RecursiveRawSyntaxFlags { | |||
switch rawData.payload { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I merged ParsedToken
PR, this switch
needs to handle it. Sorry 🙇
This allows us to check whether a subtree contains a syntax error in O(1). rdar://98575249
@swift-ci Please test |
This allows us to check whether a subtree contains a syntax error in O(1).
rdar://98575249