You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler should also be updated in the relevant reas to account for this new mangling identifier.
174
174
175
+
Next the SwiftSyntax library would be updated to add in support for this additional parameter on the `makeUniqueName(_:)` function. The logic for this method wouldn't change very much from how its currently implemented today:
176
+
177
+
```swift
178
+
// Lines prefixed with '-' are part of the current implementation being changed.
179
+
// Lines prefixed with '+' are part of the new implementation.
180
+
// Lines without a '-' or '+' prefix are part of the current implementation that are *not* being modified.
Each macro expansion context will keep track of two separate sets of unique names, one for reusable names, and one for unique names as they exist today. With this implementation in place our running example of a macro for associated object accessors would generate the same unique identifier for both macro roles:
224
+
225
+
```swift
226
+
extension AssociatedObjectMacro: PeerMacro {
227
+
staticfuncexpansion(
228
+
ofnode: AttributeSyntax,
229
+
providingPeersOfdeclaration: some DeclSyntaxProtocol,
230
+
incontext: some MacroExpansionContext
231
+
) throws-> [DeclSyntax] {
232
+
let uniqueVariableName = context.makeUniqueName("associatedObjectKey")
0 commit comments