File tree Expand file tree Collapse file tree 3 files changed +280
-278
lines changed Expand file tree Collapse file tree 3 files changed +280
-278
lines changed Original file line number Diff line number Diff line change 20
20
public protocol SyntaxTransformVisitor {
21
21
associatedtype ResultType = Void
22
22
23
+ func visitAny( _ node: Syntax ) -> ResultType
24
+
23
25
func visit( _ token: TokenSyntax ) -> ResultType
24
26
func visit( _ node: UnknownSyntax ) -> ResultType
25
27
@@ -34,16 +36,16 @@ public protocol SyntaxTransformVisitor {
34
36
}
35
37
36
38
extension SyntaxTransformVisitor {
37
- public func visit( _ token: TokenSyntax ) -> ResultType { fatalError ( " Not implemented. " ) }
38
- public func visit( _ node: UnknownSyntax ) -> ResultType { fatalError ( " Not implemented. " ) }
39
+ public func visit( _ token: TokenSyntax ) -> ResultType { visitAny ( Syntax ( token ) ) }
40
+ public func visit( _ node: UnknownSyntax ) -> ResultType { visitAny ( Syntax ( node ) ) }
39
41
40
42
% for node in SYNTAX_NODES:
41
43
% if is_visitable( node) :
42
44
/// Visiting `${node.name}` specifically.
43
45
/// - Parameter node: the node we are visiting.
44
46
/// - Returns: nil by default.
45
47
public func visit( _ node: ${ node. name} ) -> ResultType {
46
- fatalError ( " Not implemented. " )
48
+ visitAny ( Syntax ( node ) )
47
49
}
48
50
% end
49
51
% end
You can’t perform that action at this time.
0 commit comments