File tree Expand file tree Collapse file tree 3 files changed +524
-10
lines changed
Sources/AssociatedObjectPlugin
Tests/AssociatedObjectTests Expand file tree Collapse file tree 3 files changed +524
-10
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ let package = Package(
3838 ) ,
3939 . testTarget(
4040 name: " AssociatedObjectTests " ,
41- dependencies: [ " AssociatedObject " ]
41+ dependencies: [
42+ " AssociatedObject " ,
43+ . product( name: " SwiftSyntaxMacrosTestSupport " , package : " swift-syntax " )
44+ ]
4245 ) ,
4346 ]
4447)
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ extension AssociatedObjectMacro: PeerMacro {
3030 bindingSpecifier: . identifier( " static var " ) ,
3131 bindings: PatternBindingListSyntax {
3232 PatternBindingSyntax (
33- pattern: IdentifierPatternSyntax ( identifier: . identifier( " __associated_ \( identifier) Key " ) ) ,
33+ pattern: IdentifierPatternSyntax ( identifier: . identifier( " __associated_ \( identifier. trimmed ) Key " ) ) ,
3434 typeAnnotation: . init( type: IdentifierTypeSyntax ( name: . identifier( " UInt8 " ) ) ) ,
3535 initializer: InitializerClauseSyntax ( value: ExprSyntax ( stringLiteral: " 0 " ) )
3636 )
@@ -131,7 +131,7 @@ extension AssociatedObjectMacro {
131131 """
132132 objc_getAssociatedObject(
133133 self,
134- &Self.__associated_ \( identifier) Key
134+ &Self.__associated_ \( identifier. trimmed ) Key
135135 ) as? \( type)
136136 ?? \( defaultValue ?? " nil " )
137137 """
@@ -178,7 +178,7 @@ extension AssociatedObjectMacro {
178178 """
179179 objc_setAssociatedObject(
180180 self,
181- &Self.__associated_ \( identifier) Key,
181+ &Self.__associated_ \( identifier. trimmed ) Key,
182182 newValue,
183183 \( policy)
184184 )
You can’t perform that action at this time.
0 commit comments