@@ -208,7 +208,7 @@ struct DefineBitwidthNumberedStructsMacro: FreestandingDeclarationMacro {
208
208
}
209
209
}
210
210
211
- public struct PropertyWrapper { }
211
+ public struct PropertyWrapper { }
212
212
213
213
extension PropertyWrapper : AccessorDeclarationMacro {
214
214
public static func expansion(
@@ -217,9 +217,10 @@ extension PropertyWrapper: AccessorDeclarationMacro {
217
217
in context: inout MacroExpansionContext
218
218
) throws -> [ AccessorDeclSyntax ] {
219
219
guard let varDecl = declaration. as ( VariableDeclSyntax . self) ,
220
- let binding = varDecl. bindings. first,
221
- let identifier = binding. pattern. as ( IdentifierPatternSyntax . self) ? . identifier,
222
- binding. accessor == nil else {
220
+ let binding = varDecl. bindings. first,
221
+ let identifier = binding. pattern. as ( IdentifierPatternSyntax . self) ? . identifier,
222
+ binding. accessor == nil
223
+ else {
223
224
return [ ]
224
225
}
225
226
@@ -235,7 +236,7 @@ extension PropertyWrapper: AccessorDeclarationMacro {
235
236
set {
236
237
_ \( identifier) .wrappedValue = newValue
237
238
}
238
- """
239
+ """ ,
239
240
]
240
241
}
241
242
}
@@ -247,17 +248,19 @@ extension PropertyWrapper: PeerDeclarationMacro {
247
248
in context: inout MacroExpansionContext
248
249
) throws -> [ SwiftSyntax . DeclSyntax ] {
249
250
guard let varDecl = declaration. as ( VariableDeclSyntax . self) ,
250
- let binding = varDecl. bindings. first,
251
- let identifier = binding. pattern. as ( IdentifierPatternSyntax . self) ? . identifier,
252
- let type = binding. typeAnnotation? . type,
253
- binding. accessor == nil else {
251
+ let binding = varDecl. bindings. first,
252
+ let identifier = binding. pattern. as ( IdentifierPatternSyntax . self) ? . identifier,
253
+ let type = binding. typeAnnotation? . type,
254
+ binding. accessor == nil
255
+ else {
254
256
return [ ]
255
257
}
256
258
257
259
guard let wrapperTypeNameExpr = node. argumentList? . first? . expression,
258
- let stringLiteral = wrapperTypeNameExpr. as ( StringLiteralExprSyntax . self) ,
259
- stringLiteral. segments. count == 1 ,
260
- case let . stringSegment( wrapperTypeNameSegment) ? = stringLiteral. segments. first else {
260
+ let stringLiteral = wrapperTypeNameExpr. as ( StringLiteralExprSyntax . self) ,
261
+ stringLiteral. segments. count == 1 ,
262
+ case let . stringSegment( wrapperTypeNameSegment) ? = stringLiteral. segments. first
263
+ else {
261
264
return [ ]
262
265
}
263
266
@@ -461,7 +464,7 @@ public let testMacros: [String: Macro.Type] = [
461
464
" stringify " : StringifyMacro . self,
462
465
" myError " : ErrorMacro . self,
463
466
" bitwidthNumberedStructs " : DefineBitwidthNumberedStructsMacro . self,
464
- " wrapProperty " : PropertyWrapper . self,
467
+ " wrapProperty " : PropertyWrapper . self,
465
468
" addCompletionHandler " : AddCompletionHandler . self,
466
469
" addBackingStorage " : AddBackingStorage . self,
467
470
]
@@ -600,7 +603,8 @@ final class MacroSystemTests: XCTestCase {
600
603
}
601
604
}
602
605
private var _x: MyWrapperType<Int>
603
- """ )
606
+ """
607
+ )
604
608
}
605
609
606
610
func testAddCompletionHandler( ) {
0 commit comments