Skip to content

Commit cecb034

Browse files
authored
Merge pull request #1638 from whiteio/whiteio/rename-accesspathsyntax-to-importpathsyntax
Rename `AccessPathSyntax` to `ImportPathSyntax`
2 parents 6b71c97 + bdf4975 commit cecb034

22 files changed

+765
-744
lines changed

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
public let DECL_NODES: [Node] = [
14-
// FIXME: technically misnamed; should be "ImportPathComponent"
1514
Node(
16-
name: "AccessPathComponent",
15+
name: "ImportPathComponent",
1716
nameForDiagnostics: nil,
1817
kind: "Syntax",
1918
children: [
@@ -30,12 +29,11 @@ public let DECL_NODES: [Node] = [
3029
]
3130
),
3231

33-
// FIXME: technically misnamed; should be "ImportPath"
3432
Node(
35-
name: "AccessPath",
33+
name: "ImportPath",
3634
nameForDiagnostics: nil,
3735
kind: "SyntaxCollection",
38-
element: "AccessPathComponent"
36+
element: "ImportPathComponent"
3937
),
4038

4139
Node(
@@ -1094,7 +1092,7 @@ public let DECL_NODES: [Node] = [
10941092
),
10951093
Child(
10961094
name: "Path",
1097-
kind: .collection(kind: "AccessPath", collectionElementName: "PathComponent"),
1095+
kind: .collection(kind: "ImportPath", collectionElementName: "PathComponent"),
10981096
description: "The path to the module, submodule or symbol being imported."
10991097
),
11001098
]

Sources/SwiftParser/Declarations.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ extension Parser {
310310
) -> RawImportDeclSyntax {
311311
let (unexpectedBeforeImportKeyword, importKeyword) = self.eat(handle)
312312
let kind = self.parseImportKind()
313-
let path = self.parseImportAccessPath()
313+
let path = self.parseImportPath()
314314
return RawImportDeclSyntax(
315315
attributes: attrs.attributes,
316316
modifiers: attrs.modifiers,
@@ -369,22 +369,22 @@ extension Parser {
369369
}
370370

371371
@_spi(RawSyntax)
372-
public mutating func parseImportAccessPath() -> RawAccessPathSyntax {
373-
var elements = [RawAccessPathComponentSyntax]()
372+
public mutating func parseImportPath() -> RawImportPathSyntax {
373+
var elements = [RawImportPathComponentSyntax]()
374374
var keepGoing: RawTokenSyntax? = nil
375375
var loopProgress = LoopProgressCondition()
376376
repeat {
377377
let name = self.parseAnyIdentifier()
378378
keepGoing = self.consume(if: .period)
379379
elements.append(
380-
RawAccessPathComponentSyntax(
380+
RawImportPathComponentSyntax(
381381
name: name,
382382
trailingDot: keepGoing,
383383
arena: self.arena
384384
)
385385
)
386386
} while keepGoing != nil && loopProgress.evaluate(currentToken)
387-
return RawAccessPathSyntax(elements: elements, arena: self.arena)
387+
return RawImportPathSyntax(elements: elements, arena: self.arena)
388388
}
389389
}
390390

Sources/SwiftParserDiagnostics/generated/ChildNameForDiagnostics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import SwiftSyntax
1616

1717
private func childNameForDiagnostics(_ keyPath: AnyKeyPath) -> String? {
1818
switch keyPath {
19-
case \AccessPathComponentSyntax.name:
20-
return "name"
2119
case \AccessorDeclSyntax.attributes:
2220
return "attributes"
2321
case \AccessorDeclSyntax.modifier:
@@ -198,6 +196,8 @@ private func childNameForDiagnostics(_ keyPath: AnyKeyPath) -> String? {
198196
return "attributes"
199197
case \ImportDeclSyntax.modifiers:
200198
return "modifiers"
199+
case \ImportPathComponentSyntax.name:
200+
return "name"
201201
case \InitializerDeclSyntax.attributes:
202202
return "attributes"
203203
case \InitializerDeclSyntax.modifiers:

Sources/SwiftSyntax/Documentation.docc/generated/SwiftSyntax.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
194194
- <doc:SwiftSyntax/SyntaxChildren>
195195
- <doc:SwiftSyntax/SyntaxChildrenIndex>
196196
- <doc:SwiftSyntax/SyntaxChildrenIndexData>
197-
- <doc:SwiftSyntax/AccessPathSyntax>
198-
- <doc:SwiftSyntax/AccessPathComponentSyntax>
199197
- <doc:SwiftSyntax/AccessorListSyntax>
200198
- <doc:SwiftSyntax/AccessorDeclSyntax>
201199
- <doc:SwiftSyntax/ArrayElementListSyntax>
@@ -250,6 +248,8 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
250248
- <doc:SwiftSyntax/GenericRequirementSyntax>
251249
- <doc:SwiftSyntax/IfConfigClauseListSyntax>
252250
- <doc:SwiftSyntax/IfConfigClauseSyntax>
251+
- <doc:SwiftSyntax/ImportPathSyntax>
252+
- <doc:SwiftSyntax/ImportPathComponentSyntax>
253253
- <doc:SwiftSyntax/InheritedTypeListSyntax>
254254
- <doc:SwiftSyntax/InheritedTypeSyntax>
255255
- <doc:SwiftSyntax/KeyPathComponentListSyntax>

Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ public extension DeclGroupSyntax {
1919
return self.memberBlock
2020
}
2121
}
22+
23+
@available(*, deprecated, renamed: "ImportPathSyntax")
24+
public typealias AccessPathSyntax = ImportPathSyntax
25+
26+
@available(*, deprecated, renamed: "ImportPathComponentSyntax")
27+
public typealias AccessPathComponentSyntax = ImportPathComponentSyntax

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@
1717
@_spi(RawSyntax)
1818
public func childName(_ keyPath: AnyKeyPath) -> String? {
1919
switch keyPath {
20-
case \AccessPathComponentSyntax.unexpectedBeforeName:
21-
return "unexpectedBeforeName"
22-
case \AccessPathComponentSyntax.name:
23-
return "name"
24-
case \AccessPathComponentSyntax.unexpectedBetweenNameAndTrailingDot:
25-
return "unexpectedBetweenNameAndTrailingDot"
26-
case \AccessPathComponentSyntax.trailingDot:
27-
return "trailingDot"
28-
case \AccessPathComponentSyntax.unexpectedAfterTrailingDot:
29-
return "unexpectedAfterTrailingDot"
3020
case \AccessorBlockSyntax.unexpectedBeforeLeftBrace:
3121
return "unexpectedBeforeLeftBrace"
3222
case \AccessorBlockSyntax.leftBrace:
@@ -1689,6 +1679,16 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
16891679
return "path"
16901680
case \ImportDeclSyntax.unexpectedAfterPath:
16911681
return "unexpectedAfterPath"
1682+
case \ImportPathComponentSyntax.unexpectedBeforeName:
1683+
return "unexpectedBeforeName"
1684+
case \ImportPathComponentSyntax.name:
1685+
return "name"
1686+
case \ImportPathComponentSyntax.unexpectedBetweenNameAndTrailingDot:
1687+
return "unexpectedBetweenNameAndTrailingDot"
1688+
case \ImportPathComponentSyntax.trailingDot:
1689+
return "trailingDot"
1690+
case \ImportPathComponentSyntax.unexpectedAfterTrailingDot:
1691+
return "unexpectedAfterTrailingDot"
16921692
case \InOutExprSyntax.unexpectedBeforeAmpersand:
16931693
return "unexpectedBeforeAmpersand"
16941694
case \InOutExprSyntax.ampersand:

Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,6 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
5353
visitAnyPost(node._syntaxNode)
5454
}
5555

56-
override open func visit(_ node: AccessPathComponentSyntax) -> SyntaxVisitorContinueKind {
57-
return visitAny(node._syntaxNode)
58-
}
59-
60-
override open func visitPost(_ node: AccessPathComponentSyntax) {
61-
visitAnyPost(node._syntaxNode)
62-
}
63-
64-
override open func visit(_ node: AccessPathSyntax) -> SyntaxVisitorContinueKind {
65-
return visitAny(node._syntaxNode)
66-
}
67-
68-
override open func visitPost(_ node: AccessPathSyntax) {
69-
visitAnyPost(node._syntaxNode)
70-
}
71-
7256
override open func visit(_ node: AccessorBlockSyntax) -> SyntaxVisitorContinueKind {
7357
return visitAny(node._syntaxNode)
7458
}
@@ -1149,6 +1133,22 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
11491133
visitAnyPost(node._syntaxNode)
11501134
}
11511135

1136+
override open func visit(_ node: ImportPathComponentSyntax) -> SyntaxVisitorContinueKind {
1137+
return visitAny(node._syntaxNode)
1138+
}
1139+
1140+
override open func visitPost(_ node: ImportPathComponentSyntax) {
1141+
visitAnyPost(node._syntaxNode)
1142+
}
1143+
1144+
override open func visit(_ node: ImportPathSyntax) -> SyntaxVisitorContinueKind {
1145+
return visitAny(node._syntaxNode)
1146+
}
1147+
1148+
override open func visitPost(_ node: ImportPathSyntax) {
1149+
visitAnyPost(node._syntaxNode)
1150+
}
1151+
11521152
override open func visit(_ node: InOutExprSyntax) -> SyntaxVisitorContinueKind {
11531153
return visitAny(node._syntaxNode)
11541154
}

Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,6 @@ extension Syntax {
684684
public static var structure: SyntaxNodeStructure {
685685
return .choices([
686686
.node(TokenSyntax.self),
687-
.node(AccessPathComponentSyntax.self),
688-
.node(AccessPathSyntax.self),
689687
.node(AccessorBlockSyntax.self),
690688
.node(AccessorDeclSyntax.self),
691689
.node(AccessorEffectSpecifiersSyntax.self),
@@ -821,6 +819,8 @@ extension Syntax {
821819
.node(ImplementsAttributeArgumentsSyntax.self),
822820
.node(ImplicitlyUnwrappedOptionalTypeSyntax.self),
823821
.node(ImportDeclSyntax.self),
822+
.node(ImportPathComponentSyntax.self),
823+
.node(ImportPathSyntax.self),
824824
.node(InOutExprSyntax.self),
825825
.node(InfixOperatorExprSyntax.self),
826826
.node(InheritedTypeListSyntax.self),

0 commit comments

Comments
 (0)