Created
April 15, 2019 02:51
-
-
Save LucianoPAlmeida/0993a40af8ebe19e2285a1a9eba73d70 to your computer and use it in GitHub Desktop.
SyntaxVisitor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftSyntax | |
class FindPublicExtensionDeclVisitor: SyntaxVisitor { | |
override func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind { | |
if node.modifiers?.contains(where: { $0.name.tokenKind == .publicKeyword }) == true { | |
// Do something if you find a `public extension` declaration. | |
} | |
return SyntaxVisitorContinueKind.skipChildren | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment