File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax
Sources/SwiftSyntax/generated Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -335,5 +335,17 @@ let syntaxRewriterFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
335
335
}
336
336
"""
337
337
)
338
+
339
+ DeclSyntax (
340
+ """
341
+ /// Rewrite `node` and anchor, making sure that the rewritten node also has
342
+ /// a parent if `node` had one.
343
+ public func rewrite(_ node: Syntax) -> Syntax {
344
+ let rewritten = self.visit(node)
345
+ let arena = SyntaxArena()
346
+ return Syntax(node.data.replacingSelf(rewritten.raw, arena: arena))
347
+ }
348
+ """
349
+ )
338
350
}
339
351
}
Original file line number Diff line number Diff line change @@ -6941,4 +6941,12 @@ open class SyntaxRewriter {
6941
6941
return node
6942
6942
}
6943
6943
}
6944
+
6945
+ /// Rewrite `node` and anchor, making sure that the rewritten node also has
6946
+ /// a parent if `node` had one.
6947
+ public func rewrite( _ node: Syntax ) -> Syntax {
6948
+ let rewritten = self . visit ( node)
6949
+ let arena = SyntaxArena ( )
6950
+ return Syntax ( node. data. replacingSelf ( rewritten. raw, arena: arena) )
6951
+ }
6944
6952
}
You can’t perform that action at this time.
0 commit comments