Classes
The following classes are available globally.
-
A Swift syntax visitor that collects declarations.
Create an instance of
DeclarationCollector
and pass it by reference when walking an AST created bySyntaxParser
to collect any visited declarations:
See moreimport SwiftSyntax import SwiftSemantics let source = #"enum E {}"# var collector = DeclarationCollector() let tree = try SyntaxParser.parse(source: source) tree.walk(&collector) collector.enumerations.first?.name // "E"
Declaration
Swift
open class DeclarationCollector
extension DeclarationCollector: SyntaxVisitor