Skip to content

Commit db7eb73

Browse files
committed
Remove newline between EnumCaseDeclSyntax
1 parent 4b226f2 commit db7eb73

16 files changed

+9
-1010
lines changed

CodeGeneration/Sources/Utils/CodeGenerationFormat.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ public class CodeGenerationFormat: BasicFormat {
2727
}
2828
}
2929

30-
public override func visit(_ node: MemberDeclBlockSyntax) -> MemberDeclBlockSyntax {
31-
if node.members.count == 0 {
32-
return node.with(\.leftBrace, .leftBraceToken())
33-
} else {
34-
return super.visit(node)
35-
}
36-
}
37-
3830
public override func visit(_ node: CodeBlockItemSyntax) -> CodeBlockItemSyntax {
3931
if node.parent?.parent?.is(SourceFileSyntax.self) == true, !shouldBeSeparatedByTwoNewlines(node: node) {
4032
let formatted = super.visit(node)
@@ -64,9 +56,17 @@ public class CodeGenerationFormat: BasicFormat {
6456
}
6557
}
6658

59+
public override func visit(_ node: MemberDeclBlockSyntax) -> MemberDeclBlockSyntax {
60+
if node.members.count == 0 {
61+
return node.with(\.leftBrace, .leftBraceToken())
62+
} else {
63+
return super.visit(node)
64+
}
65+
}
66+
6767
public override func visit(_ node: MemberDeclListItemSyntax) -> MemberDeclListItemSyntax {
6868
let formatted = super.visit(node)
69-
if node.indexInParent != 0 {
69+
if node.indexInParent != 0 && !node.decl.is(EnumCaseDeclSyntax.self) {
7070
return ensuringTwoLeadingNewlines(node: formatted)
7171
} else {
7272
return formatted

Sources/IDEUtils/generated/SyntaxClassification.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,58 +17,40 @@
1717
public enum SyntaxClassification {
1818
/// An attribute starting with an `@`.
1919
case attribute
20-
2120
/// A block comment starting with `/**` and ending with `*/.
2221
case blockComment
23-
2422
/// A build configuration directive like `#if`, `#elseif`, `#else`.
2523
case buildConfigId
26-
2724
/// A doc block comment starting with `/**` and ending with `*/.
2825
case docBlockComment
29-
3026
/// A doc line comment starting with `///`.
3127
case docLineComment
32-
3328
/// An identifier starting with `$` like `$0`.
3429
case dollarIdentifier
35-
3630
/// An editor placeholder of the form `<#content#>`
3731
case editorPlaceholder
38-
3932
/// A floating point literal.
4033
case floatingLiteral
41-
4234
/// A generic identifier.
4335
case identifier
44-
4536
/// An integer literal.
4637
case integerLiteral
47-
4838
/// A Swift keyword, including contextual keywords.
4939
case keyword
50-
5140
/// A line comment starting with `//`.
5241
case lineComment
53-
5442
/// The token should not receive syntax coloring.
5543
case none
56-
5744
/// An image, color, etc. literal.
5845
case objectLiteral
59-
6046
/// An identifier referring to an operator.
6147
case operatorIdentifier
62-
6348
/// A `#` keyword like `#warning`.
6449
case poundDirectiveKeyword
65-
6650
/// The opening and closing parenthesis of string interpolation.
6751
case stringInterpolationAnchor
68-
6952
/// A string literal including multiline string literals.
7053
case stringLiteral
71-
7254
/// An identifier referring to a type.
7355
case typeIdentifier
7456
}

Sources/SwiftParser/generated/DeclarationModifier.swift

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,69 +16,37 @@
1616

1717
enum DeclarationModifier: TokenSpecSet {
1818
case `static`
19-
2019
case `class`
21-
2220
case final
23-
2421
case required
25-
2622
case optional
27-
2823
case lazy
29-
3024
case dynamic
31-
3225
case infix
33-
3426
case prefix
35-
3627
case postfix
37-
3828
case __consuming
39-
4029
case mutating
41-
4230
case nonmutating
43-
4431
case convenience
45-
4632
case override
47-
4833
case `private`
49-
5034
case `fileprivate`
51-
5235
case `internal`
53-
5436
case `public`
55-
5637
case package
57-
5838
case open
59-
6039
case __setter_access
61-
6240
case weak
63-
6441
case unowned
65-
6642
case `rethrows`
67-
6843
case indirect
69-
7044
case isolated
71-
7245
case async
73-
7446
case reasync
75-
7647
case nonisolated
77-
7848
case distributed
79-
8049
case _const
81-
8250
case _local
8351

8452
init?(lexeme: Lexer.Lexeme) {

Sources/SwiftParser/generated/TypeAttribute.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,16 @@
1717
extension Parser {
1818
enum TypeAttribute: TokenSpecSet {
1919
case autoclosure
20-
2120
case convention
22-
2321
case noescape
24-
2522
case escaping
26-
2723
case differentiable
28-
2924
case noDerivative
30-
3125
case async
32-
3326
case Sendable
34-
3527
case unchecked
36-
3728
case _local
38-
3929
case _noMetadata
40-
4130
case _opaqueReturnTypeOf
4231

4332
init?(lexeme: Lexer.Lexeme) {

0 commit comments

Comments
 (0)