@@ -14,7 +14,7 @@ private func replaceFirstLabel(
1414 }
1515
1616 return tuple. replacing (
17- childAt: 0 , with: firstElement. withLabel ( . identifier( newLabel) ) )
17+ childAt: 0 , with: firstElement. with ( \ . label , . identifier( newLabel) ) )
1818}
1919
2020public struct ColorLiteralMacro : ExpressionMacro {
@@ -26,7 +26,7 @@ public struct ColorLiteralMacro: ExpressionMacro {
2626 )
2727 let initSyntax : ExprSyntax = " .init( \( argList) ) "
2828 if let leadingTrivia = macro. leadingTrivia {
29- return initSyntax. withLeadingTrivia ( leadingTrivia)
29+ return initSyntax. with ( \ . leadingTrivia , leadingTrivia)
3030 }
3131 return initSyntax
3232 }
@@ -38,7 +38,7 @@ public struct FileIDMacro: ExpressionMacro {
3838 ) -> ExprSyntax {
3939 let fileLiteral : ExprSyntax = #"" \#( raw: context. moduleName) / \#( raw: context. fileName) ""#
4040 if let leadingTrivia = macro. leadingTrivia {
41- return fileLiteral. withLeadingTrivia ( leadingTrivia)
41+ return fileLiteral. with ( \ . leadingTrivia , leadingTrivia)
4242 }
4343 return fileLiteral
4444 }
@@ -82,7 +82,7 @@ public enum AddBlocker: ExpressionMacro {
8282 }
8383
8484 // Link the folded argument back into the tree.
85- let node = node. withArgumentList ( node. argumentList. replacing ( childAt: 0 , with: node. argumentList. first!. withExpression ( foldedArgument. as ( ExprSyntax . self) !) ) )
85+ let node = node. with ( \ . argumentList , node. argumentList. replacing ( childAt: 0 , with: node. argumentList. first!. with ( \ . expression , foldedArgument. as ( ExprSyntax . self) !) ) )
8686
8787 class AddVisitor : SyntaxRewriter {
8888 var diagnostics : [ Diagnostic ] = [ ]
@@ -102,8 +102,8 @@ public enum AddBlocker: ExpressionMacro {
102102 severity: . error
103103 ) ,
104104 highlights: [
105- Syntax ( node. leftOperand. withoutTrivia ( ) ) ,
106- Syntax ( node. rightOperand. withoutTrivia ( ) )
105+ Syntax ( node. leftOperand. with ( \ . leadingTrivia , [ ] ) . with ( \ . trailingTrivia , [ ] ) ) ,
106+ Syntax ( node. rightOperand. with ( \ . leadingTrivia , [ ] ) . with ( \ . trailingTrivia , [ ] ) )
107107 ] ,
108108 fixIts: [
109109 FixIt (
@@ -114,7 +114,7 @@ public enum AddBlocker: ExpressionMacro {
114114 ) ,
115115 changes: [
116116 FixIt . Change. replace (
117- oldNode: Syntax ( binOp. operatorToken. withoutTrivia ( ) ) ,
117+ oldNode: Syntax ( binOp. operatorToken. with ( \ . leadingTrivia , [ ] ) . with ( \ . trailingTrivia , [ ] ) ) ,
118118 newNode: Syntax (
119119 TokenSyntax (
120120 . binaryOperator( " - " ) ,
@@ -129,9 +129,11 @@ public enum AddBlocker: ExpressionMacro {
129129 )
130130
131131 return ExprSyntax (
132- node. withOperatorOperand (
132+ node. with (
133+ \. operatorOperand,
133134 ExprSyntax (
134- binOp. withOperatorToken (
135+ binOp. with (
136+ \. operatorToken,
135137 binOp. operatorToken. withKind ( . binaryOperator( " - " ) )
136138 )
137139 )
0 commit comments