Skip to content

Commit 87977eb

Browse files
committed
[SyntaxRewriter] Avoid unnecessary work to replace node's parents for SyntaxRewriter
The SyntaxRewriter only needs to collect root nodes to compose together, we don't need to replace the parent hiearchy for these temporary root nodes.
1 parent 5e10466 commit 87977eb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Sources/SwiftSyntax/SyntaxRewriter.swift.gyb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ open class SyntaxRewriter {
9595
assert(newLayout.count == node.raw.numberOfChildren)
9696

9797
let newRaw = node.raw.replacingLayout(newLayout)
98-
let newData = node.base.data.replacingSelf(newRaw)
99-
return makeSyntax(newData)
98+
return makeSyntax(.forRoot(newRaw))
10099
}
101100
}
102101

0 commit comments

Comments
 (0)