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) {
335335 }
336336 """
337337 )
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+ )
338350 }
339351}
Original file line number Diff line number Diff line change @@ -6941,4 +6941,12 @@ open class SyntaxRewriter {
69416941 return node
69426942 }
69436943 }
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+ }
69446952}
You can’t perform that action at this time.
0 commit comments