8000 Add a SyntaxVerifier to assert no unknown syntax in a fully parsed tree. by nkcsgexi · Pull Request #40 · swiftlang/swift-syntax · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 1 commit into from
Nov 15, 2018

Conversation

nkcsgexi
Copy link
Contributor

No description provided.

@nkcsgexi
Copy link
Contributor Author

@swift-ci please test

@nkcsgexi
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ac1dbfa

@nkcsgexi
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 1e42603

@nkcsgexi nkcsgexi merged commit 36dbcbe into swiftlang:master Nov 15, 2018
Copy link
Member
@ahoppen ahoppen left a 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] = []
Copy link
Member

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 {
Copy link
Member

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)
}

adevress pushed a commit to adevress/swift-syntax that referenced this pull request Jan 14, 2024
Prevent extra indentation for trailing closures in specific function …
64A1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0