@@ -14,7 +14,7 @@ private func replaceFirstLabel(
14
14
}
15
15
16
16
return tuple. replacing (
17
- childAt: 0 , with: firstElement. withLabel ( . identifier( newLabel) ) )
17
+ childAt: 0 , with: firstElement. with ( \ . label , . identifier( newLabel) ) )
18
18
}
19
19
20
20
public struct ColorLiteralMacro : ExpressionMacro {
@@ -26,7 +26,7 @@ public struct ColorLiteralMacro: ExpressionMacro {
26
26
)
27
27
let initSyntax : ExprSyntax = " .init( \( argList) ) "
28
28
if let leadingTrivia = macro. leadingTrivia {
29
- return initSyntax. withLeadingTrivia ( leadingTrivia)
29
+ return initSyntax. with ( \ . leadingTrivia , leadingTrivia)
30
30
}
31
31
return initSyntax
32
32
}
@@ -38,7 +38,7 @@ public struct FileIDMacro: ExpressionMacro {
38
38
) -> ExprSyntax {
39
39
let fileLiteral : ExprSyntax = #"" \#( raw: context. moduleName) / \#( raw: context. fileName) ""#
40
40
if let leadingTrivia = macro. leadingTrivia {
41
- return fileLiteral. withLeadingTrivia ( leadingTrivia)
41
+ return fileLiteral. with ( \ . leadingTrivia , leadingTrivia)
42
42
}
43
43
return fileLiteral
44
44
}
@@ -82,7 +82,7 @@ public enum AddBlocker: ExpressionMacro {
82
82
}
83
83
84
84
// 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) !) ) )
86
86
87
87
class AddVisitor : SyntaxRewriter {
88
88
var diagnostics : [ Diagnostic ] = [ ]
@@ -102,8 +102,8 @@ public enum AddBlocker: ExpressionMacro {
102
102
severity: . error
103
103
) ,
104
104
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 , [ ] ) )
107
107
] ,
108
108
fixIts: [
109
109
FixIt (
@@ -114,7 +114,7 @@ public enum AddBlocker: ExpressionMacro {
114
114
) ,
115
115
changes: [
116
116
FixIt . Change. replace (
117
- oldNode: Syntax ( binOp. operatorToken. withoutTrivia ( ) ) ,
117
+ oldNode: Syntax ( binOp. operatorToken) ,
118
118
newNode: Syntax (
119
119
TokenSyntax (
120
120
. binaryOperator( " - " ) ,
@@ -129,9 +129,11 @@ public enum AddBlocker: ExpressionMacro {
129
129
)
130
130
131
131
return ExprSyntax (
132
- node. withOperatorOperand (
132
+ node. with (
133
+ \. operatorOperand,
133
134
ExprSyntax (
134
- binOp. withOperatorToken (
135
+ binOp. with (
136
+ \. operatorToken,
135
137
binOp. operatorToken. withKind ( . binaryOperator( " - " ) )
136
138
)
137
139
)
0 commit comments