-
Notifications
You must be signed in to change notification settings - Fork 439
Add a SyntaxVerifier to assert no unknown syntax in a fully parsed tree. #40
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
@swift-ci please test |
@swift-ci please test |
Build failed |
@swift-ci please test |
Build failed |
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've got some minor comments to make the PR more swifty™.
|
||
public class SyntaxVerifier: SyntaxVisitor { | ||
|
||
var UnknownNodes: [Syntax] = [] |
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.
Nitpick: Don't capitalise variable names in Swift
|
||
private func verify(_ node: Syntax) throws { | ||
node.walk(self) | ||
if !UnknownNodes.isEmpty { |
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.
You could just use optional binding here which get's rid of the force unwrap below
if let unknownNode = UnknownNodes.first {
throw SyntaxVerifierError.unknownSyntaxFound(node: unknownNode)
}
Prevent extra indentation for trailing closures in specific function …
No description provided.