Skip to content

Commit aea93fc

Browse files
authored
Merge pull request #63962 from rxwei/rename-createuniquename
[Macros] Rename `createUniqueName` to `makeUniqueName`
2 parents 6b89b62 + 77c886c commit aea93fc

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/ASTGen/Sources/ASTGen/SourceManager+MacroExpansionContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extension String {
5353

5454
extension SourceManager.MacroExpansionContext: MacroExpansionContext {
5555
/// Generate a unique name for use in the macro.
56-
public func createUniqueName(_ providedName: String) -> TokenSyntax {
56+
public func makeUniqueName(_ providedName: String) -> TokenSyntax {
5757
// If provided with an empty name, substitute in something.
5858
let name = providedName.isEmpty ? "__local" : providedName
5959

test/Macros/Inputs/syntax_macro_definitions.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ public struct DefineBitwidthNumberedStructsMacro: DeclarationMacro {
227227
"""
228228
229229
struct \(raw: prefix) {
230-
func \(context.createUniqueName("method"))() { return 0 }
231-
func \(context.createUniqueName("method"))() { return 1 }
230+
func \(context.makeUniqueName("method"))() { return 0 }
231+
func \(context.makeUniqueName("method"))() { return 1 }
232232
}
233233
"""
234234
]
@@ -238,8 +238,8 @@ public struct DefineBitwidthNumberedStructsMacro: DeclarationMacro {
238238
"""
239239
240240
struct \(raw: prefix)\(raw: String(bitwidth)) {
241-
func \(context.createUniqueName("method"))() { }
242-
func \(context.createUniqueName("method"))() { }
241+
func \(context.makeUniqueName("method"))() { }
242+
func \(context.makeUniqueName("method"))() { }
243243
}
244244
"""
245245
}
@@ -255,15 +255,15 @@ public struct DefineDeclsWithKnownNamesMacro: DeclarationMacro {
255255
"""
256256
257257
struct A {
258-
func \(context.createUniqueName("method"))() { }
259-
func \(context.createUniqueName("method"))() { }
258+
func \(context.makeUniqueName("method"))() { }
259+
func \(context.makeUniqueName("method"))() { }
260260
}
261261
""",
262262
"""
263263
264264
struct B {
265-
func \(context.createUniqueName("method"))() { }
266-
func \(context.createUniqueName("method"))() { }
265+
func \(context.makeUniqueName("method"))() { }
266+
func \(context.makeUniqueName("method"))() { }
267267
}
268268
""",
269269
"""
@@ -853,7 +853,7 @@ public struct WrapInType: PeerMacro {
853853
funcDecl
854854
.with(
855855
\.identifier,
856-
"\(context.createUniqueName(funcDecl.identifier.text))"
856+
"\(context.makeUniqueName(funcDecl.identifier.text))"
857857
)
858858
.with(
859859
\.signature,
@@ -874,7 +874,7 @@ public struct WrapInType: PeerMacro {
874874

875875
let structType: DeclSyntax =
876876
"""
877-
struct \(context.createUniqueName(funcDecl.identifier.text)) {
877+
struct \(context.makeUniqueName(funcDecl.identifier.text)) {
878878
\(method)
879879
}
880880
"""

0 commit comments

Comments
 (0)