Skip to content

Rename AccessPathSyntax to ImportPathSyntax #1638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
//===----------------------------------------------------------------------===//

public let DECL_NODES: [Node] = [
// FIXME: technically misnamed; should be "ImportPathComponent"
Node(
name: "AccessPathComponent",
name: "ImportPathComponent",
nameForDiagnostics: nil,
kind: "Syntax",
children: [
Expand All @@ -30,12 +29,11 @@ public let DECL_NODES: [Node] = [
]
),

// FIXME: technically misnamed; should be "ImportPath"
Node(
name: "AccessPath",
name: "ImportPath",
nameForDiagnostics: nil,
kind: "SyntaxCollection",
element: "AccessPathComponent"
element: "ImportPathComponent"
),

Node(
Expand Down Expand Up @@ -1094,7 +1092,7 @@ public let DECL_NODES: [Node] = [
),
Child(
name: "Path",
kind: .collection(kind: "AccessPath", collectionElementName: "PathComponent"),
kind: .collection(kind: "ImportPath", collectionElementName: "PathComponent"),
description: "The path to the module, submodule or symbol being imported."
),
]
Expand Down
10 changes: 5 additions & 5 deletions Sources/SwiftParser/Declarations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ extension Parser {
) -> RawImportDeclSyntax {
let (unexpectedBeforeImportKeyword, importKeyword) = self.eat(handle)
let kind = self.parseImportKind()
let path = self.parseImportAccessPath()
let path = self.parseImportPath()
return RawImportDeclSyntax(
attributes: attrs.attributes,
modifiers: attrs.modifiers,
Expand Down Expand Up @@ -369,22 +369,22 @@ extension Parser {
}

@_spi(RawSyntax)
public mutating func parseImportAccessPath() -> RawAccessPathSyntax {
var elements = [RawAccessPathComponentSyntax]()
public mutating func parseImportPath() -> RawImportPathSyntax {
var elements = [RawImportPathComponentSyntax]()
var keepGoing: RawTokenSyntax? = nil
var loopProgress = LoopProgressCondition()
repeat {
let name = self.parseAnyIdentifier()
keepGoing = self.consume(if: .period)
elements.append(
RawAccessPathComponentSyntax(
RawImportPathComponentSyntax(
name: name,
trailingDot: keepGoing,
arena: self.arena
)
)
} while keepGoing != nil && loopProgress.evaluate(currentToken)
return RawAccessPathSyntax(elements: elements, arena: self.arena)
return RawImportPathSyntax(elements: elements, arena: self.arena)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import SwiftSyntax

private func childNameForDiagnostics(_ keyPath: AnyKeyPath) -> String? {
switch keyPath {
case \AccessPathComponentSyntax.name:
return "name"
case \AccessorDeclSyntax.attributes:
return "attributes"
case \AccessorDeclSyntax.modifier:
Expand Down Expand Up @@ -198,6 +196,8 @@ private func childNameForDiagnostics(_ keyPath: AnyKeyPath) -> String? {
return "attributes"
case \ImportDeclSyntax.modifiers:
return "modifiers"
case \ImportPathComponentSyntax.name:
return "name"
case \InitializerDeclSyntax.attributes:
return "attributes"
case \InitializerDeclSyntax.modifiers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
- <doc:SwiftSyntax/SyntaxChildren>
- <doc:SwiftSyntax/SyntaxChildrenIndex>
- <doc:SwiftSyntax/SyntaxChildrenIndexData>
- <doc:SwiftSyntax/AccessPathSyntax>
- <doc:SwiftSyntax/AccessPathComponentSyntax>
- <doc:SwiftSyntax/AccessorListSyntax>
- <doc:SwiftSyntax/AccessorDeclSyntax>
- <doc:SwiftSyntax/ArrayElementListSyntax>
Expand Down Expand Up @@ -250,6 +248,8 @@ allows Swift tools to parse, inspect, generate, and transform Swift source code.
- <doc:SwiftSyntax/GenericRequirementSyntax>
- <doc:SwiftSyntax/IfConfigClauseListSyntax>
- <doc:SwiftSyntax/IfConfigClauseSyntax>
- <doc:SwiftSyntax/ImportPathSyntax>
- <doc:SwiftSyntax/ImportPathComponentSyntax>
- <doc:SwiftSyntax/InheritedTypeListSyntax>
- <doc:SwiftSyntax/InheritedTypeSyntax>
- <doc:SwiftSyntax/KeyPathComponentListSyntax>
Expand Down
6 changes: 6 additions & 0 deletions Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ public extension DeclGroupSyntax {
return self.memberBlock
}
}

@available(*, deprecated, renamed: "ImportPathSyntax")
public typealias AccessPathSyntax = ImportPathSyntax

@available(*, deprecated, renamed: "ImportPathComponentSyntax")
public typealias AccessPathComponentSyntax = ImportPathComponentSyntax
20 changes: 10 additions & 10 deletions Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@
@_spi(RawSyntax)
public func childName(_ keyPath: AnyKeyPath) -> String? {
switch keyPath {
case \AccessPathComponentSyntax.unexpectedBeforeName:
return "unexpectedBeforeName"
case \AccessPathComponentSyntax.name:
return "name"
case \AccessPathComponentSyntax.unexpectedBetweenNameAndTrailingDot:
return "unexpectedBetweenNameAndTrailingDot"
case \AccessPathComponentSyntax.trailingDot:
return "trailingDot"
case \AccessPathComponentSyntax.unexpectedAfterTrailingDot:
return "unexpectedAfterTrailingDot"
case \AccessorBlockSyntax.unexpectedBeforeLeftBrace:
return "unexpectedBeforeLeftBrace"
case \AccessorBlockSyntax.leftBrace:
Expand Down Expand Up @@ -1689,6 +1679,16 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
return "path"
case \ImportDeclSyntax.unexpectedAfterPath:
return "unexpectedAfterPath"
case \ImportPathComponentSyntax.unexpectedBeforeName:
return "unexpectedBeforeName"
case \ImportPathComponentSyntax.name:
return "name"
case \ImportPathComponentSyntax.unexpectedBetweenNameAndTrailingDot:
return "unexpectedBetweenNameAndTrailingDot"
case \ImportPathComponentSyntax.trailingDot:
return "trailingDot"
case \ImportPathComponentSyntax.unexpectedAfterTrailingDot:
return "unexpectedAfterTrailingDot"
case \InOutExprSyntax.unexpectedBeforeAmpersand:
return "unexpectedBeforeAmpersand"
case \InOutExprSyntax.ampersand:
Expand Down
32 changes: 16 additions & 16 deletions Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,6 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
visitAnyPost(node._syntaxNode)
}

override open func visit(_ node: AccessPathComponentSyntax) -> SyntaxVisitorContinueKind {
return visitAny(node._syntaxNode)
}

override open func visitPost(_ node: AccessPathComponentSyntax) {
visitAnyPost(node._syntaxNode)
}

override open func visit(_ node: AccessPathSyntax) -> SyntaxVisitorContinueKind {
return visitAny(node._syntaxNode)
}

override open func visitPost(_ node: AccessPathSyntax) {
visitAnyPost(node._syntaxNode)
}

override open func visit(_ node: AccessorBlockSyntax) -> SyntaxVisitorContinueKind {
return visitAny(node._syntaxNode)
}
Expand Down Expand Up @@ -1149,6 +1133,22 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
visitAnyPost(node._syntaxNode)
}

override open func visit(_ node: ImportPathComponentSyntax) -> SyntaxVisitorContinueKind {
return visitAny(node._syntaxNode)
}

override open func visitPost(_ node: ImportPathComponentSyntax) {
visitAnyPost(node._syntaxNode)
}

override open func visit(_ node: ImportPathSyntax) -> SyntaxVisitorContinueKind {
return visitAny(node._syntaxNode)
}

override open func visitPost(_ node: ImportPathSyntax) {
visitAnyPost(node._syntaxNode)
}

override open func visit(_ node: InOutExprSyntax) -> SyntaxVisitorContinueKind {
return visitAny(node._syntaxNode)
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftSyntax/generated/SyntaxBaseNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,6 @@ extension Syntax {
public static var structure: SyntaxNodeStructure {
return .choices([
.node(TokenSyntax.self),
.node(AccessPathComponentSyntax.self),
.node(AccessPathSyntax.self),
.node(AccessorBlockSyntax.self),
.node(AccessorDeclSyntax.self),
.node(AccessorEffectSpecifiersSyntax.self),
Expand Down Expand Up @@ -821,6 +819,8 @@ extension Syntax {
.node(ImplementsAttributeArgumentsSyntax.self),
.node(ImplicitlyUnwrappedOptionalTypeSyntax.self),
.node(ImportDeclSyntax.self),
.node(ImportPathComponentSyntax.self),
.node(ImportPathSyntax.self),
.node(InOutExprSyntax.self),
.node(InfixOperatorExprSyntax.self),
.node(InheritedTypeListSyntax.self),
Expand Down
Loading