Skip to content

Commit 52e8020

Browse files
committed
Rename TestingMacroExpansionContext --> BasicMacroExpansionContext
1 parent 74c5315 commit 52e8020

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

Sources/_SwiftSyntaxMacros/TestingMacroExpansionContext.swift renamed to Sources/_SwiftSyntaxMacros/BasicMacroExpansionContext.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SwiftSyntax
1515

1616
/// An implementation of the `MacroExpansionContext` protocol that is
1717
/// suitable for testing purposes.
18-
public class TestingMacroExpansionContext {
18+
public class BasicMacroExpansionContext {
1919
/// A single source file that is known to the macro expansion context.
2020
public struct KnownSourceFile {
2121
/// The name of the module in which this source file resides.
@@ -86,7 +86,7 @@ extension String {
8686
}
8787

8888
}
89-
extension TestingMacroExpansionContext: MacroExpansionContext {
89+
extension BasicMacroExpansionContext: MacroExpansionContext {
9090
/// Generate a unique name for use in the macro.
9191
public func createUniqueName(_ providedName: String) -> TokenSyntax {
9292
// If provided with an empty name, substitute in something.

Sources/_SwiftSyntaxMacros/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ add_swift_host_library(_SwiftSyntaxMacros
1818
MacroProtocols/MemberMacro.swift
1919
MacroProtocols/PeerMacro.swift
2020

21+
BasicMacroExpansionContext.swift
2122
MacroExpansionContext.swift
2223
MacroSystem.swift
2324
Syntax+MacroEvaluation.swift

Sources/_SwiftSyntaxMacros/Syntax+MacroEvaluation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extension SyntaxProtocol {
5959
// track it.
6060
//
6161
// TODO: Should this be generalized?
62-
if let testingContext = context as? TestingMacroExpansionContext,
62+
if let testingContext = context as? BasicMacroExpansionContext,
6363
let parentSourceFile = root.as(SourceFileSyntax.self) {
6464
testingContext.addDisconnected(
6565
Syntax(detached), at: position, in: parentSourceFile

Tests/SwiftSyntaxMacrosTest/MacroSystemTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ public func AssertMacroExpansion(
595595
let origSourceFile = Parser.parse(source: originalSource)
596596

597597
// Expand all macros in the source.
598-
let context = TestingMacroExpansionContext(
598+
let context = BasicMacroExpansionContext(
599599
sourceFiles: [origSourceFile : .init(moduleName: testModuleName, fullFilePath: testFileName) ]
600600
)
601601
let expandedSourceFile = origSourceFile.expand(macros: macros, in: context)
@@ -685,7 +685,7 @@ final class MacroSystemTests: XCTestCase {
685685
}
686686

687687
func testContextUniqueLocalNames() {
688-
let context = TestingMacroExpansionContext()
688+
let context = BasicMacroExpansionContext()
689689

690690
let t1 = context.createUniqueName("mine")
691691
let t2 = context.createUniqueName("mine")

0 commit comments

Comments
 (0)