File tree 3 files changed +524
-10
lines changed
Sources/AssociatedObjectPlugin
Tests/AssociatedObjectTests
3 files changed +524
-10
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ let package = Package(
38
38
) ,
39
39
. testTarget(
40
40
name: " AssociatedObjectTests " ,
41
- dependencies: [ " AssociatedObject " ]
41
+ dependencies: [
42
+ " AssociatedObject " ,
43
+ . product( name: " SwiftSyntaxMacrosTestSupport " , package : " swift-syntax " )
44
+ ]
42
45
) ,
43
46
]
44
47
)
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ extension AssociatedObjectMacro: PeerMacro {
30
30
bindingSpecifier: . identifier( " static var " ) ,
31
31
bindings: PatternBindingListSyntax {
32
32
PatternBindingSyntax (
33
- pattern: IdentifierPatternSyntax ( identifier: . identifier( " __associated_ \( identifier) Key " ) ) ,
33
+ pattern: IdentifierPatternSyntax ( identifier: . identifier( " __associated_ \( identifier. trimmed ) Key " ) ) ,
34
34
typeAnnotation: . init( type: IdentifierTypeSyntax ( name: . identifier( " UInt8 " ) ) ) ,
35
35
initializer: InitializerClauseSyntax ( value: ExprSyntax ( stringLiteral: " 0 " ) )
36
36
)
@@ -131,7 +131,7 @@ extension AssociatedObjectMacro {
131
131
"""
132
132
objc_getAssociatedObject(
133
133
self,
134
- &Self.__associated_ \( identifier) Key
134
+ &Self.__associated_ \( identifier. trimmed ) Key
135
135
) as? \( type)
136
136
?? \( defaultValue ?? " nil " )
137
137
"""
@@ -178,7 +178,7 @@ extension AssociatedObjectMacro {
178
178
"""
179
179
objc_setAssociatedObject(
180
180
self,
181
- &Self.__associated_ \( identifier) Key,
181
+ &Self.__associated_ \( identifier. trimmed ) Key,
182
182
newValue,
183
183
\( policy)
184
184
)
You can’t perform that action at this time.
0 commit comments