Skip to content

Commit 953bf89

Browse files
committed
A couple more property renames in the syntax tree
1 parent cb134fa commit 953bf89

17 files changed

+272
-125
lines changed

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1957,7 +1957,8 @@ public let DECL_NODES: [Node] = [
19571957
kind: .token(choices: [.token(tokenKind: "ColonToken")])
19581958
),
19591959
Child(
1960-
name: "OtherNames",
1960+
name: "PrecedenceGroups",
1961+
deprecatedName: "OtherNames",
19611962
kind: .collection(kind: .precedenceGroupNameList, collectionElementName: "OtherName"),
19621963
documentation: "The name of other precedence group to which this precedence group relates."
19631964
),

CodeGeneration/Sources/SyntaxSupport/ExprNodes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,8 @@ public let EXPR_NODES: [Node] = [
941941
kind: .node(kind: .expr)
942942
),
943943
Child(
944-
name: "OperatorOperand",
944+
name: "Operator",
945+
deprecatedName: "OperatorOperand",
945946
kind: .node(kind: .expr)
946947
),
947948
Child(

CodeGeneration/Sources/SyntaxSupport/StmtNodes.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ public let STMT_NODES: [Node] = [
534534
kind: .token(choices: [.keyword(text: "where")])
535535
),
536536
Child(
537-
name: "GuardResult",
537+
name: "Condition",
538+
deprecatedName: "GuardResult",
538539
kind: .node(kind: .expr)
539540
),
540541
]

Sources/SwiftOperators/OperatorTable+Folding.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ extension OperatorTable {
141141
return ExprSyntax(
142142
InfixOperatorExprSyntax(
143143
leftOperand: lhs,
144-
operatorOperand: ExprSyntax(binaryOperatorExpr),
144+
operator: ExprSyntax(binaryOperatorExpr),
145145
rightOperand: rhs
146146
)
147147
)
@@ -168,7 +168,7 @@ extension OperatorTable {
168168
return ExprSyntax(
169169
InfixOperatorExprSyntax(
170170
leftOperand: lhs,
171-
operatorOperand: ExprSyntax(assignExpr),
171+
operator: ExprSyntax(assignExpr),
172172
rightOperand: rhs
173173
)
174174
)
@@ -209,7 +209,7 @@ extension OperatorTable {
209209
return ExprSyntax(
210210
InfixOperatorExprSyntax(
211211
leftOperand: lhs,
212-
operatorOperand: ExprSyntax(arrowExpr),
212+
operator: ExprSyntax(arrowExpr),
213213
rightOperand: rhs
214214
)
215215
)

Sources/SwiftOperators/OperatorTable+Semantics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extension PrecedenceGroup {
2424
// Relation (lowerThan, higherThan)
2525
case .precedenceGroupRelation(let relation):
2626
let isLowerThan = relation.higherThanOrLowerThanLabel.text == "lowerThan"
27-
for otherGroup in relation.otherNames {
27+
for otherGroup in relation.precedenceGroups {
2828
let otherGroupName = otherGroup.name.text
2929
let relationKind: PrecedenceRelation.Kind =
3030
isLowerThan

Sources/SwiftOperators/PrecedenceGraph.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ struct PrecedenceGraph {
109109
relationSyntax = Syntax(knownSyntax)
110110
} else {
111111
relationSyntax =
112-
Syntax(relation.synthesizedSyntax().otherNames.first!.name)
112+
Syntax(relation.synthesizedSyntax().precedenceGroups.first!.name)
113113
}
114114
stack.append((otherGroupName, relationSyntax))
115115
}

Sources/SwiftOperators/SyntaxSynthesis.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ extension PrecedenceRelation {
6060
leadingTrivia: [.newlines(1), .spaces(indentation)]
6161
),
6262
colon: .colonToken(),
63-
otherNames: PrecedenceGroupNameListSyntax(
63+
precedenceGroups: PrecedenceGroupNameListSyntax(
6464
[
6565
PrecedenceGroupNameElementSyntax(
6666
name: .identifier(groupName, leadingTrivia: .space)

Sources/SwiftParser/Declarations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,7 @@ extension Parser {
18101810
higherThanOrLowerThanLabel: level,
18111811
unexpectedBeforeColon,
18121812
colon: colon,
1813-
otherNames: RawPrecedenceGroupNameListSyntax(elements: names, arena: self.arena),
1813+
precedenceGroups: RawPrecedenceGroupNameListSyntax(elements: names, arena: self.arena),
18141814
arena: self.arena
18151815
)
18161816
)

Sources/SwiftParser/Expressions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,10 +2354,10 @@ extension Parser {
23542354
// vars in scope.
23552355
let whereClause: RawWhereClauseSyntax?
23562356
if let whereKeyword = self.consume(if: .keyword(.where)) {
2357-
let guardExpr = self.parseExpression(.trailingClosure)
2357+
let condition = self.parseExpression(.trailingClosure)
23582358
whereClause = RawWhereClauseSyntax(
23592359
whereKeyword: whereKeyword,
2360-
guardResult: guardExpr,
2360+
condition: condition,
23612361
arena: self.arena
23622362
)
23632363
} else {

Sources/SwiftParser/Statements.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,10 @@ extension Parser {
437437
// Parse the optional 'where' guard.
438438
let whereClause: RawWhereClauseSyntax?
439439
if let whereKeyword = self.consume(if: .keyword(.where)) {
440-
let guardExpr = self.parseExpression(.basic)
440+
let condition = self.parseExpression(.basic)
441441
whereClause = RawWhereClauseSyntax(
442442
whereKeyword: whereKeyword,
443-
guardResult: guardExpr,
443+
condition: condition,
444444
arena: self.arena
445445
)
446446
} else {
@@ -548,10 +548,10 @@ extension Parser {
548548
// Parse the 'where' expression if present.
549549
let whereClause: RawWhereClauseSyntax?
550550
if let whereKeyword = self.consume(if: .keyword(.where)) {
551-
let guardExpr = self.parseExpression(.basic)
551+
let condition = self.parseExpression(.basic)
552552
whereClause = RawWhereClauseSyntax(
553553
whereKeyword: whereKeyword,
554-
guardResult: guardExpr,
554+
condition: condition,
555555
arena: self.arena
556556
)
557557
} else {

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,12 +1803,12 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
18031803
return "unexpectedBeforeLeftOperand"
18041804
case \InfixOperatorExprSyntax.leftOperand:
18051805
return "leftOperand"
1806-
case \InfixOperatorExprSyntax.unexpectedBetweenLeftOperandAndOperatorOperand:
1807-
return "unexpectedBetweenLeftOperandAndOperatorOperand"
1808-
case \InfixOperatorExprSyntax.operatorOperand:
1809-
return "operatorOperand"
1810-
case \InfixOperatorExprSyntax.unexpectedBetweenOperatorOperandAndRightOperand:
1811-
return "unexpectedBetweenOperatorOperandAndRightOperand"
1806+
case \InfixOperatorExprSyntax.unexpectedBetweenLeftOperandAndOperator:
1807+
return "unexpectedBetweenLeftOperandAndOperator"
1808+
case \InfixOperatorExprSyntax.operator:
1809+
return "operator"
1810+
case \InfixOperatorExprSyntax.unexpectedBetweenOperatorAndRightOperand:
1811+
return "unexpectedBetweenOperatorAndRightOperand"
18121812
case \InfixOperatorExprSyntax.rightOperand:
18131813
return "rightOperand"
18141814
case \InfixOperatorExprSyntax.unexpectedAfterRightOperand:
@@ -2661,12 +2661,12 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
26612661
return "unexpectedBetweenHigherThanOrLowerThanLabelAndColon"
26622662
case \PrecedenceGroupRelationSyntax.colon:
26632663
return "colon"
2664-
case \PrecedenceGroupRelationSyntax.unexpectedBetweenColonAndOtherNames:
2665-
return "unexpectedBetweenColonAndOtherNames"
2666-
case \PrecedenceGroupRelationSyntax.otherNames:
2667-
return "otherNames"
2668-
case \PrecedenceGroupRelationSyntax.unexpectedAfterOtherNames:
2669-
return "unexpectedAfterOtherNames"
2664+
case \PrecedenceGroupRelationSyntax.unexpectedBetweenColonAndPrecedenceGroups:
2665+
return "unexpectedBetweenColonAndPrecedenceGroups"
2666+
case \PrecedenceGroupRelationSyntax.precedenceGroups:
2667+
return "precedenceGroups"
2668+
case \PrecedenceGroupRelationSyntax.unexpectedAfterPrecedenceGroups:
2669+
return "unexpectedAfterPrecedenceGroups"
26702670
case \PrefixOperatorExprSyntax.unexpectedBeforeOperator:
26712671
return "unexpectedBeforeOperator"
26722672
case \PrefixOperatorExprSyntax.operator:
@@ -3429,12 +3429,12 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
34293429
return "unexpectedBeforeWhereKeyword"
34303430
case \WhereClauseSyntax.whereKeyword:
34313431
return "whereKeyword"
3432-
case \WhereClauseSyntax.unexpectedBetweenWhereKeywordAndGuardResult:
3433-
return "unexpectedBetweenWhereKeywordAndGuardResult"
3434-
case \WhereClauseSyntax.guardResult:
3435-
return "guardResult"
3436-
case \WhereClauseSyntax.unexpectedAfterGuardResult:
3437-
return "unexpectedAfterGuardResult"
3432+
case \WhereClauseSyntax.unexpectedBetweenWhereKeywordAndCondition:
3433+
return "unexpectedBetweenWhereKeywordAndCondition"
3434+
case \WhereClauseSyntax.condition:
3435+
return "condition"
3436+
case \WhereClauseSyntax.unexpectedAfterCondition:
3437+
return "unexpectedAfterCondition"
34383438
case \WhileStmtSyntax.unexpectedBeforeWhileKeyword:
34393439
return "unexpectedBeforeWhileKeyword"
34403440
case \WhileStmtSyntax.whileKeyword:

Sources/SwiftSyntax/generated/RenamedChildrenCompatibility.swift

Lines changed: 146 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3671,6 +3671,65 @@ extension ImportPathComponentSyntax {
36713671
}
36723672
}
36733673

3674+
extension InfixOperatorExprSyntax {
3675+
@available(*, deprecated, renamed: "unexpectedBetweenLeftOperandAndOperator")
3676+
public var unexpectedBetweenLeftOperandAndOperatorOperand: UnexpectedNodesSyntax? {
3677+
get {
3678+
return unexpectedBetweenLeftOperandAndOperator
3679+
}
3680+
set {
3681+
unexpectedBetweenLeftOperandAndOperator = newValue
3682+
}
3683+
}
3684+
3685+
@available(*, deprecated, renamed: "operator")
3686+
public var operatorOperand: ExprSyntax {
3687+
get {
3688+
return `operator`
3689+
}
3690+
set {
3691+
`operator` = newValue
3692+
}
3693+
}
3694+
3695+
@available(*, deprecated, renamed: "unexpectedBetweenOperatorAndRightOperand")
3696+
public var unexpectedBetweenOperatorOperandAndRightOperand: UnexpectedNodesSyntax? {
3697+
get {
3698+
return unexpectedBetweenOperatorAndRightOperand
3699+
}
3700+
set {
3701+
unexpectedBetweenOperatorAndRightOperand = newValue
3702+
}
3703+
}
3704+
3705+
@available(*, deprecated, message: "Use an initializer with operator argument(s).")
3706+
@_disfavoredOverload
3707+
public init(
3708+
leadingTrivia: Trivia? = nil,
3709+
_ unexpectedBeforeLeftOperand: UnexpectedNodesSyntax? = nil,
3710+
leftOperand: some ExprSyntaxProtocol,
3711+
_ unexpectedBetweenLeftOperandAndOperatorOperand: UnexpectedNodesSyntax? = nil,
3712+
operatorOperand: some ExprSyntaxProtocol,
3713+
_ unexpectedBetweenOperatorOperandAndRightOperand: UnexpectedNodesSyntax? = nil,
3714+
rightOperand: some ExprSyntaxProtocol,
3715+
_ unexpectedAfterRightOperand: UnexpectedNodesSyntax? = nil,
3716+
trailingTrivia: Trivia? = nil
3717+
3718+
) {
3719+
self.init(
3720+
leadingTrivia: leadingTrivia,
3721+
unexpectedBeforeLeftOperand,
3722+
leftOperand: leftOperand,
3723+
unexpectedBetweenLeftOperandAndOperatorOperand,
3724+
operator: operatorOperand,
3725+
unexpectedBetweenOperatorOperandAndRightOperand,
3726+
rightOperand: rightOperand,
3727+
unexpectedAfterRightOperand,
3728+
trailingTrivia: trailingTrivia
3729+
)
3730+
}
3731+
}
3732+
36743733
extension InheritedTypeSyntax {
36753734
@available(*, deprecated, renamed: "unexpectedBeforeType")
36763735
public var unexpectedBeforeTypeName: UnexpectedNodesSyntax? {
@@ -5820,7 +5879,37 @@ extension PrecedenceGroupRelationSyntax {
58205879
}
58215880
}
58225881

5823-
@available(*, deprecated, message: "Use an initializer with higherThanOrLowerThanLabel argument(s).")
5882+
@available(*, deprecated, renamed: "unexpectedBetweenColonAndPrecedenceGroups")
5883+
public var unexpectedBetweenColonAndOtherNames: UnexpectedNodesSyntax? {
5884+
get {
5885+
return unexpectedBetweenColonAndPrecedenceGroups
5886+
}
5887+
set {
5888+
unexpectedBetweenColonAndPrecedenceGroups = newValue
5889+
}
5890+
}
5891+
5892+
@available(*, deprecated, renamed: "precedenceGroups")
5893+
public var otherNames: PrecedenceGroupNameListSyntax {
5894+
get {
5895+
return precedenceGroups
5896+
}
5897+
set {
5898+
precedenceGroups = newValue
5899+
}
5900+
}
5901+
5902+
@available(*, deprecated, renamed: "unexpectedAfterPrecedenceGroups")
5903+
public var unexpectedAfterOtherNames: UnexpectedNodesSyntax? {
5904+
get {
5905+
return unexpectedAfterPrecedenceGroups
5906+
}
5907+
set {
5908+
unexpectedAfterPrecedenceGroups = newValue
5909+
}
5910+
}
5911+
5912+
@available(*, deprecated, message: "Use an initializer with higherThanOrLowerThanLabel, precedenceGroups argument(s).")
58245913
@_disfavoredOverload
58255914
public init(
58265915
leadingTrivia: Trivia? = nil,
@@ -5841,7 +5930,7 @@ extension PrecedenceGroupRelationSyntax {
58415930
unexpectedBetweenHigherThanOrLowerThanAndColon,
58425931
colon: colon,
58435932
unexpectedBetweenColonAndOtherNames,
5844-
otherNames: otherNames,
5933+
precedenceGroups: otherNames,
58455934
unexpectedAfterOtherNames,
58465935
trailingTrivia: trailingTrivia
58475936
)
@@ -7658,6 +7747,61 @@ extension VariableDeclSyntax {
76587747
}
76597748
}
76607749

7750+
extension WhereClauseSyntax {
7751+
@available(*, deprecated, renamed: "unexpectedBetweenWhereKeywordAndCondition")
7752+
public var unexpectedBetweenWhereKeywordAndGuardResult: UnexpectedNodesSyntax? {
7753+
get {
7754+
return unexpectedBetweenWhereKeywordAndCondition
7755+
}
7756+
set {
7757+
unexpectedBetweenWhereKeywordAndCondition = newValue
7758+
}
7759+
}
7760+
7761+
@available(*, deprecated, renamed: "condition")
7762+
public var guardResult: ExprSyntax {
7763+
get {
7764+
return condition
7765+
}
7766+
set {
7767+
condition = newValue
7768+
}
7769+
}
7770+
7771+
@available(*, deprecated, renamed: "unexpectedAfterCondition")
7772+
public var unexpectedAfterGuardResult: UnexpectedNodesSyntax? {
7773+
get {
7774+
return unexpectedAfterCondition
7775+
}
7776+
set {
7777+
unexpectedAfterCondition = newValue
7778+
}
7779+
}
7780+
7781+
@available(*, deprecated, message: "Use an initializer with condition argument(s).")
7782+
@_disfavoredOverload
7783+
public init(
7784+
leadingTrivia: Trivia? = nil,
7785+
_ unexpectedBeforeWhereKeyword: UnexpectedNodesSyntax? = nil,
7786+
whereKeyword: TokenSyntax = .keyword(.where),
7787+
_ unexpectedBetweenWhereKeywordAndGuardResult: UnexpectedNodesSyntax? = nil,
7788+
guardResult: some ExprSyntaxProtocol,
7789+
_ unexpectedAfterGuardResult: UnexpectedNodesSyntax? = nil,
7790+
trailingTrivia: Trivia? = nil
7791+
7792+
) {
7793+
self.init(
7794+
leadingTrivia: leadingTrivia,
7795+
unexpectedBeforeWhereKeyword,
7796+
whereKeyword: whereKeyword,
7797+
unexpectedBetweenWhereKeywordAndGuardResult,
7798+
condition: guardResult,
7799+
unexpectedAfterGuardResult,
7800+
trailingTrivia: trailingTrivia
7801+
)
7802+
}
7803+
}
7804+
76617805
extension YieldListSyntax {
76627806
@available(*, deprecated, renamed: "unexpectedBetweenLeftParenAndElements")
76637807
public var unexpectedBetweenLeftParenAndElementList: UnexpectedNodesSyntax? {

0 commit comments

Comments
 (0)