Skip to content

Commit a38578c

Browse files
committed
Remove QualifiedDeclNameSyntax
1 parent 3eb344c commit a38578c

21 files changed

+37
-469
lines changed

CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public let ATTRIBUTE_NODES: [Node] = [
340340
),
341341
Child(
342342
name: "OriginalDeclName",
343-
kind: .node(kind: .qualifiedDeclName),
343+
kind: .node(kind: .expr),
344344
documentation: "The referenced original declaration name."
345345
),
346346
Child(
@@ -776,43 +776,6 @@ public let ATTRIBUTE_NODES: [Node] = [
776776
]
777777
),
778778

779-
// An optionally qualified declaration name.
780-
// Currently used only for `@derivative` and `@transpose` attribute.
781-
// TODO(TF-1066): Use module qualified name syntax/parsing instead of custom
782-
// qualified name syntax/parsing.
783-
//
784-
// qualified-decl-name ->
785-
// base-type? '.'? (identifier | operator) decl-name-arguments?
786-
// base-type ->
787-
// member-type-identifier | base-type-identifier
788-
Node(
789-
kind: .qualifiedDeclName,
790-
base: .syntax,
791-
nameForDiagnostics: "declaration name",
792-
documentation: "An optionally qualified function declaration name (e.g. `+(_:_:)`, `A.B.C.foo(_:_:)`).",
793-
children: [
794-
Child(
795-
name: "BaseType",
796-
kind: .node(kind: .type),
797-
nameForDiagnostics: "base type",
798-
documentation: "The base type of the qualified name, optionally specified.",
799-
isOptional: true
800-
),
801-
Child(
802-
name: "Period",
803-
deprecatedName: "Dot",
804-
kind: .token(choices: [.token(.period)]),
805-
isOptional: true
806-
),
807-
Child(
808-
name: "DeclName",
809-
kind: .node(kind: .declReferenceExpr),
810-
nameForDiagnostics: "name",
811-
documentation: "The name of the referenced function."
812-
),
813-
]
814-
),
815-
816779
// The argument of '@_specialize(...)'
817780
// specialize-attr-spec-list -> labeled-specialize-entry
818781
// specialize-spec-attr-list?

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,11 +1184,13 @@ public let EXPR_NODES: [Node] = [
11841184
kind: .memberAccessExpr,
11851185
base: .expr,
11861186
nameForDiagnostics: "member access",
1187+
documentation: "An expression that access a member like a function or a property.",
11871188
children: [
11881189
Child(
11891190
name: "Base",
11901191
kind: .node(kind: .expr),
11911192
nameForDiagnostics: "base",
1193+
documentation: "The base of the member access, optionally specified.",
11921194
isOptional: true
11931195
),
11941196
Child(
@@ -1199,7 +1201,8 @@ public let EXPR_NODES: [Node] = [
11991201
Child(
12001202
name: "DeclName",
12011203
kind: .node(kind: .declReferenceExpr),
1202-
nameForDiagnostics: "name"
1204+
nameForDiagnostics: "name",
1205+
documentation: "The name of the referenced function or a property."
12031206
),
12041207
]
12051208
),

CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ public enum SyntaxNodeKind: String, CaseIterable {
237237
case primaryAssociatedTypeClause
238238
case primaryAssociatedTypeList
239239
case protocolDecl
240-
case qualifiedDeclName
241240
case regexLiteralExpr
242241
case repeatStmt
243242
case returnClause

Sources/SwiftParser/Names.swift

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,12 @@ extension Parser {
145145
}
146146

147147
extension Parser {
148-
mutating func parseQualifiedDeclarationName() -> RawQualifiedDeclNameSyntax {
149-
let type: RawTypeSyntax?
148+
mutating func parseQualifiedDeclarationName() -> RawExprSyntax {
149+
let type: RawExprSyntax?
150150
let period: RawTokenSyntax?
151+
151152
if self.lookahead().canParseBaseTypeForQualifiedDeclName() {
152-
type = self.parseQualifiedTypeIdentifier()
153+
type = RawExprSyntax(RawTypeExprSyntax(type: self.parseQualifiedTypeIdentifier(), arena: self.arena))
153154
period = self.consumePrefix(".", as: .period)
154155
} else {
155156
type = nil
@@ -161,12 +162,18 @@ extension Parser {
161162
.keywordsUsingSpecialNames,
162163
.operators,
163164
])
164-
return RawQualifiedDeclNameSyntax(
165-
baseType: type,
166-
period: period,
167-
declName: declName,
168-
arena: self.arena
169-
)
165+
if let period = period {
166+
return RawExprSyntax(
167+
RawMemberAccessExprSyntax(
168+
base: type,
169+
period: period,
170+
declName: declName,
171+
arena: self.arena
172+
)
173+
)
174+
} else {
175+
return RawExprSyntax(declName)
176+
}
170177
}
171178

172179
mutating func parseQualifiedTypeIdentifier() -> RawTypeSyntax {

Sources/SwiftParserDiagnostics/generated/ChildNameForDiagnostics.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,6 @@ private func childNameForDiagnostics(_ keyPath: AnyKeyPath) -> String? {
282282
return "inheritance clause"
283283
case \ProtocolDeclSyntax.genericWhereClause:
284284
return "generic where clause"
285-
case \QualifiedDeclNameSyntax.baseType:
286-
return "base type"
287-
case \QualifiedDeclNameSyntax.declName:
288-
return "name"
289285
case \RepeatStmtSyntax.body:
290286
return "body"
291287
case \RepeatStmtSyntax.condition:

Sources/SwiftParserDiagnostics/generated/SyntaxKindNameForDiagnostics.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ extension SyntaxKind {
321321
return "primary associated type clause"
322322
case .protocolDecl:
323323
return "protocol"
324-
case .qualifiedDeclName:
325-
return "declaration name"
326324
case .regexLiteralExpr:
327325
return "regex literal"
328326
case .repeatStmt:

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ These articles are intended for developers wishing to contribute to SwiftSyntax
333333
- <doc:SwiftSyntax/OriginallyDefinedInAttributeArgumentsSyntax>
334334
- <doc:SwiftSyntax/PlatformVersionItemListSyntax>
335335
- <doc:SwiftSyntax/PlatformVersionItemSyntax>
336-
- <doc:SwiftSyntax/QualifiedDeclNameSyntax>
337336
- <doc:SwiftSyntax/SpecializeAttributeArgumentListSyntax>
338337
- <doc:SwiftSyntax/SpecializeAvailabilityArgumentSyntax>
339338
- <doc:SwiftSyntax/SpecializeTargetFunctionArgumentSyntax>

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,20 +2675,6 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
26752675
return "memberBlock"
26762676
case \ProtocolDeclSyntax.unexpectedAfterMemberBlock:
26772677
return "unexpectedAfterMemberBlock"
2678-
case \QualifiedDeclNameSyntax.unexpectedBeforeBaseType:
2679-
return "unexpectedBeforeBaseType"
2680-
case \QualifiedDeclNameSyntax.baseType:
2681-
return "baseType"
2682-
case \QualifiedDeclNameSyntax.unexpectedBetweenBaseTypeAndPeriod:
2683-
return "unexpectedBetweenBaseTypeAndPeriod"
2684-
case \QualifiedDeclNameSyntax.period:
2685-
return "period"
2686-
case \QualifiedDeclNameSyntax.unexpectedBetweenPeriodAndDeclName:
2687-
return "unexpectedBetweenPeriodAndDeclName"
2688-
case \QualifiedDeclNameSyntax.declName:
2689-
return "declName"
2690-
case \QualifiedDeclNameSyntax.unexpectedAfterDeclName:
2691-
return "unexpectedAfterDeclName"
26922678
case \RegexLiteralExprSyntax.unexpectedBeforeOpeningPounds:
26932679
return "unexpectedBeforeOpeningPounds"
26942680
case \RegexLiteralExprSyntax.openingPounds:

Sources/SwiftSyntax/generated/RenamedChildrenCompatibility.swift

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ extension DerivativeAttributeArgumentsSyntax {
17031703
_ unexpectedBetweenOfLabelAndColon: UnexpectedNodesSyntax? = nil,
17041704
colon: TokenSyntax = .colonToken(),
17051705
_ unexpectedBetweenColonAndOriginalDeclName: UnexpectedNodesSyntax? = nil,
1706-
originalDeclName: QualifiedDeclNameSyntax,
1706+
originalDeclName: some ExprSyntaxProtocol,
17071707
_ unexpectedBetweenOriginalDeclNameAndPeriod: UnexpectedNodesSyntax? = nil,
17081708
period: TokenSyntax? = nil,
17091709
_ unexpectedBetweenPeriodAndAccessorKind: UnexpectedNodesSyntax? = nil,
@@ -6650,65 +6650,6 @@ extension ProtocolDeclSyntax {
66506650
}
66516651
}
66526652

6653-
extension QualifiedDeclNameSyntax {
6654-
@available(*, deprecated, renamed: "unexpectedBetweenBaseTypeAndPeriod")
6655-
public var unexpectedBetweenBaseTypeAndDot: UnexpectedNodesSyntax? {
6656-
get {
6657-
return unexpectedBetweenBaseTypeAndPeriod
6658-
}
6659-
set {
6660-
unexpectedBetweenBaseTypeAndPeriod = newValue
6661-
}
6662-
}
6663-
6664-
@available(*, deprecated, renamed: "period")
6665-
public var dot: TokenSyntax? {
6666-
get {
6667-
return period
6668-
}
6669-
set {
6670-
period = newValue
6671-
}
6672-
}
6673-
6674-
@available(*, deprecated, renamed: "unexpectedBetweenPeriodAndDeclName")
6675-
public var unexpectedBetweenDotAndDeclName: UnexpectedNodesSyntax? {
6676-
get {
6677-
return unexpectedBetweenPeriodAndDeclName
6678-
}
6679-
set {
6680-
unexpectedBetweenPeriodAndDeclName = newValue
6681-
}
6682-
}
6683-
6684-
@available(*, deprecated, renamed: "QualifiedDeclNameSyntax(leadingTrivia:_:baseType:_:period:_:declName:_:trailingTrivia:)")
6685-
@_disfavoredOverload
6686-
public init(
6687-
leadingTrivia: Trivia? = nil,
6688-
_ unexpectedBeforeBaseType: UnexpectedNodesSyntax? = nil,
6689-
baseType: (some TypeSyntaxProtocol)? = TypeSyntax?.none,
6690-
_ unexpectedBetweenBaseTypeAndDot: UnexpectedNodesSyntax? = nil,
6691-
dot: TokenSyntax? = nil,
6692-
_ unexpectedBetweenDotAndDeclName: UnexpectedNodesSyntax? = nil,
6693-
declName: DeclReferenceExprSyntax,
6694-
_ unexpectedAfterDeclName: UnexpectedNodesSyntax? = nil,
6695-
trailingTrivia: Trivia? = nil
6696-
6697-
) {
6698-
self.init(
6699-
leadingTrivia: leadingTrivia,
6700-
unexpectedBeforeBaseType,
6701-
baseType: baseType,
6702-
unexpectedBetweenBaseTypeAndDot,
6703-
period: dot,
6704-
unexpectedBetweenDotAndDeclName,
6705-
declName: declName,
6706-
unexpectedAfterDeclName,
6707-
trailingTrivia: trailingTrivia
6708-
)
6709-
}
6710-
}
6711-
67126653
extension RegexLiteralExprSyntax {
67136654
@available(*, deprecated, renamed: "unexpectedBetweenOpeningPoundsAndOpeningSlash")
67146655
public var unexpectedBetweenOpeningPoundsAndOpenSlash: UnexpectedNodesSyntax? {

Sources/SwiftSyntax/generated/SyntaxAnyVisitor.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,14 +1765,6 @@ open class SyntaxAnyVisitor: SyntaxVisitor {
17651765
visitAnyPost(node._syntaxNode)
17661766
}
17671767

1768-
override open func visit(_ node: QualifiedDeclNameSyntax) -> SyntaxVisitorContinueKind {
1769-
return visitAny(node._syntaxNode)
1770-
}
1771-
1772-
override open func visitPost(_ node: QualifiedDeclNameSyntax) {
1773-
visitAnyPost(node._syntaxNode)
1774-
}
1775-
17761768
override open func visit(_ node: RegexLiteralExprSyntax) -> SyntaxVisitorContinueKind {
17771769
return visitAny(node._syntaxNode)
17781770
}

0 commit comments

Comments
 (0)