Skip to content

Commit f2b3e6c

Browse files
authored
Merge pull request #485 from gottesmm/pr-75fc86c01aedaf6fda5f5fdbefc4787f08f64eb9
[reference-bindings] Change letOrVarKeyword -> bindingKeyword.
2 parents 3cd655f + 4ae7690 commit f2b3e6c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,14 +1909,14 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
19091909
if node.bindings.count == 1 {
19101910
// If there is only a single binding, don't allow a break between the `let/var` keyword and
19111911
// the identifier; there are better places to break later on.
1912-
after(node.letOrVarKeyword, tokens: .space)
1912+
after(node.bindingKeyword, tokens: .space)
19131913
} else {
19141914
// If there is more than one binding, we permit an open-break after `let/var` so that each of
19151915
// the comma-delimited items will potentially receive indentation. We also add a group around
19161916
// the individual bindings to bind them together better. (This is done here, not in
19171917
// `visit(_: PatternBindingSyntax)`, because we only want that behavior when there are
19181918
// multiple bindings.)
1919-
after(node.letOrVarKeyword, tokens: .break(.open))
1919+
after(node.bindingKeyword, tokens: .break(.open))
19201920

19211921
for binding in node.bindings {
19221922
before(binding.firstToken, tokens: .open)
@@ -2106,7 +2106,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
21062106
}
21072107

21082108
override func visit(_ node: ValueBindingPatternSyntax) -> SyntaxVisitorContinueKind {
2109-
after(node.letOrVarKeyword, tokens: .break)
2109+
after(node.bindingKeyword, tokens: .break)
21102110
return .visitChildren
21112111
}
21122112

@@ -2290,7 +2290,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
22902290
}
22912291

22922292
override func visit(_ node: OptionalBindingConditionSyntax) -> SyntaxVisitorContinueKind {
2293-
after(node.letOrVarKeyword, tokens: .break)
2293+
after(node.bindingKeyword, tokens: .break)
22942294

22952295
if let typeAnnotation = node.typeAnnotation {
22962296
after(

Sources/SwiftFormatRules/AlwaysUseLowerCamelCase.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ fileprivate func identifierDescription<NodeType: SyntaxProtocol>(for node: NodeT
173173
case .enumCaseElement: return "enum case"
174174
case .functionDecl: return "function"
175175
case .optionalBindingCondition(let binding):
176-
return binding.letOrVarKeyword.tokenKind == .keyword(.var) ? "variable" : "constant"
176+
return binding.bindingKeyword.tokenKind == .keyword(.var) ? "variable" : "constant"
177177
case .variableDecl(let variableDecl):
178-
return variableDecl.letOrVarKeyword.tokenKind == .keyword(.var) ? "variable" : "constant"
178+
return variableDecl.bindingKeyword.tokenKind == .keyword(.var) ? "variable" : "constant"
179179
default:
180180
return "identifier"
181181
}

Sources/SwiftFormatRules/UseShorthandTypeNames.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {
542542
isStoredProperty(patternBinding),
543543
patternBinding.initializer == nil,
544544
let variableDecl = nearestAncestor(of: patternBinding, type: VariableDeclSyntax.self),
545-
variableDecl.letOrVarKeyword.tokenKind == .keyword(.var)
545+
variableDecl.bindingKeyword.tokenKind == .keyword(.var)
546546
{
547547
return true
548548
}

Sources/SwiftFormatRules/UseSynthesizedInitializer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public final class UseSynthesizedInitializer: SyntaxLintRule {
116116
// Ensure that parameters that correspond to properties declared using 'var' have a default
117117
// argument that is identical to the property's default value. Otherwise, a default argument
118118
// doesn't match the memberwise initializer.
119-
let isVarDecl = property.letOrVarKeyword.tokenKind == .keyword(.var)
119+
let isVarDecl = property.bindingKeyword.tokenKind == .keyword(.var)
120120
if isVarDecl, let initializer = property.firstInitializer {
121121
guard let defaultArg = parameter.defaultArgument else { return false }
122122
guard initializer.value.description == defaultArg.value.description else { return false }

0 commit comments

Comments
 (0)