File tree Expand file tree Collapse file tree 2 files changed +289
-289
lines changed
CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntax
Sources/SwiftSyntax/generated Expand file tree Collapse file tree 2 files changed +289
-289
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ let syntaxRewriterFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
160
160
/// - Returns: the rewritten node
161
161
\( node. apiAttributes ( ) ) \
162
162
open func visit(_ node: \( node. kind. syntaxType) ) -> \( node. kind. syntaxType) {
163
- return visitChildren(node._syntaxNode)? .cast( \( node. kind. syntaxType) .self) ?? node
163
+ return visitChildren(node._syntaxNode).cast( \( node. kind. syntaxType) .self)
164
164
}
165
165
"""
166
166
)
@@ -172,7 +172,7 @@ let syntaxRewriterFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
172
172
/// - Returns: the rewritten node
173
173
\( node. apiAttributes ( ) ) \
174
174
open func visit(_ node: \( node. kind. syntaxType) ) -> \( node. baseType. syntaxBaseName) {
175
- return \( node. baseType. syntaxBaseName) (visitChildren(node._syntaxNode)? .cast( \( node. kind. syntaxType) .self) ?? node )
175
+ return \( node. baseType. syntaxBaseName) (visitChildren(node._syntaxNode).cast( \( node. kind. syntaxType) .self))
176
176
}
177
177
"""
178
178
)
@@ -302,7 +302,7 @@ let syntaxRewriterFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
302
302
303
303
DeclSyntax (
304
304
"""
305
- private func visitChildren(_ node: Syntax) -> Syntax? {
305
+ private func visitChildren(_ node: Syntax) -> Syntax {
306
306
// Walk over all children of this node and rewrite them. Don't store any
307
307
// rewritten nodes until the first non-`nil` value is encountered. When this
308
308
// happens, retrieve all previous syntax nodes from the parent node to
@@ -357,7 +357,7 @@ let syntaxRewriterFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
357
357
}
358
358
} else {
359
359
// No child node was rewritten. So no need to change this node as well.
360
- return nil
360
+ return node
361
361
}
362
362
}
363
363
"""
You can’t perform that action at this time.
0 commit comments