Skip to content

Commit a3ef115

Browse files
committed
Apply cases for all spaced binary operators
1 parent f167aa4 commit a3ef115

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ let basicFormatFile = SourceFile {
124124
FunctionDecl("open func requiresLeadingSpace(_ token: TokenSyntax) -> Bool") {
125125
SwitchStmt("""
126126
switch (token.previousToken(viewMode: .sourceAccurate)?.tokenKind, token.tokenKind) {
127-
case (.postfixQuestionMark, .rightAngle): // Ensures there is not space in `MyGeneric<Foo?>`
128-
return false
129-
case (.leftParen, .spacedBinaryOperator("*")):
127+
case (.leftParen, .spacedBinaryOperator):
130128
return false
131129
default:
132130
break
@@ -169,7 +167,7 @@ let basicFormatFile = SourceFile {
169167
(.tryKeyword, .exclamationMark), // Ensures there is not space in `try!`
170168
(.tryKeyword, .postfixQuestionMark): // Ensures there is not space in `try?`
171169
return false
172-
case (.spacedBinaryOperator("*"), .comma):
170+
case (.spacedBinaryOperator, .comma):
173171
return false
174172
default:
175173
break

Sources/SwiftBasicFormat/generated/BasicFormat.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ open class BasicFormat: SyntaxRewriter {
131131

132132
open func requiresLeadingSpace(_ token: TokenSyntax) -> Bool {
133133
switch (token.previousToken(viewMode: .sourceAccurate)?.tokenKind, token.tokenKind) {
134-
case (.postfixQuestionMark, .rightAngle): // Ensures there is not space in `MyGeneric<Foo?>`
135-
return false
136-
case (.leftParen, .spacedBinaryOperator("*")):
134+
case (.leftParen, .spacedBinaryOperator):
137135
return false
138136
default:
139137
break
@@ -176,7 +174,7 @@ open class BasicFormat: SyntaxRewriter {
176174
(.tryKeyword, .exclamationMark), // Ensures there is not space in `try!`
177175
(.tryKeyword, .postfixQuestionMark): // Ensures there is not space in `try?`
178176
return false
179-
case (.spacedBinaryOperator("*"), .comma):
177+
case (.spacedBinaryOperator, .comma):
180178
return false
181179
default:
182180
break

0 commit comments

Comments
 (0)