@@ -25,8 +25,19 @@ public protocol MacroExpansionContext: AnyObject {
25
25
///
26
26
/// - Returns: an identifier token containing a unique name that will not
27
27
/// conflict with any other name in a well-formed program.
28
+ @available ( * , renamed: " makeUniqueName(_:) " )
28
29
func createUniqueName( _ name: String ) -> TokenSyntax
29
30
31
+ /// Generate a unique name for use in the macro.
32
+ ///
33
+ /// - Parameters:
34
+ /// - name: The name to use as a basis for the uniquely-generated name,
35
+ /// which will appear in the unique name that's produced here.
36
+ ///
37
+ /// - Returns: an identifier token containing a unique name that will not
38
+ /// conflict with any other name in a well-formed program.
39
+ func makeUniqueName( _ name: String ) -> TokenSyntax
40
+
30
41
/// Produce a diagnostic while expanding the macro.
31
42
func diagnose( _ diagnostic: Diagnostic )
32
43
@@ -137,6 +148,31 @@ extension MacroExpansionContext {
137
148
column: " \( literal: column) "
138
149
)
139
150
}
151
+
152
+ /// Generate a unique name for use in the macro.
153
+ ///
154
+ /// - Parameters:
155
+ /// - name: The name to use as a basis for the uniquely-generated name,
156
+ /// which will appear in the unique name that's produced here.
157
+ ///
158
+ /// - Returns: an identifier token containing a unique name that will not
159
+ /// conflict with any other name in a well-formed program.
160
+ @available ( * , renamed: " makeUniqueName(_:) " )
161
+ public func createUniqueName( _ name: String ) -> TokenSyntax {
162
+ makeUniqueName ( name)
163
+ }
164
+
165
+ /// Generate a unique name for use in the macro.
166
+ ///
167
+ /// - Parameters:
168
+ /// - name: The name to use as a basis for the uniquely-generated name,
169
+ /// which will appear in the unique name that's produced here.
170
+ ///
171
+ /// - Returns: an identifier token containing a unique name that will not
172
+ /// conflict with any other name in a well-formed program.
173
+ public func makeUniqueName( _ name: String ) -> TokenSyntax {
174
+ createUniqueName ( name)
175
+ }
140
176
}
141
177
142
178
/// Diagnostic message used for thrown errors.
0 commit comments