Skip to content

Commit 57e865e

Browse files
committed
Make the modifier list a collection
1 parent 159d886 commit 57e865e

File tree

8 files changed

+46
-20
lines changed

8 files changed

+46
-20
lines changed

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,9 @@ public let DECL_NODES: [Node] = [
9898
),
9999
Child(
100100
name: "modifiers",
101-
kind: .node(kind: .declModifierList),
101+
kind: .collection(kind: .declModifierList, collectionElementName: "Modifier", defaultsToEmpty: true),
102102
nameForDiagnostics: "modifiers",
103-
isOptional: true
104-
),
103+
documentation: "Modifiers like `mutating` or `yielding` that affect the accessor declaration." ),
105104
Child(
106105
name: "accessorSpecifier",
107106
kind: .token(choices: [

Sources/SwiftParser/Declarations.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,15 +1658,13 @@ extension Parser {
16581658

16591659
struct AccessorIntroducer {
16601660
var attributes: RawAttributeListSyntax
1661-
var modifiers: RawDeclModifierListSyntax?
1661+
var modifiers: RawDeclModifierListSyntax
16621662
var kind: AccessorDeclSyntax.AccessorSpecifierOptions
16631663
var unexpectedBeforeToken: RawUnexpectedNodesSyntax?
16641664
var token: RawTokenSyntax
16651665
}
16661666

1667-
mutating func parseAccessorModifierList(count: Int) -> RawDeclModifierListSyntax? {
1668-
if count == 0 { return nil }
1669-
1667+
mutating func parseAccessorModifierList(count: Int) -> RawDeclModifierListSyntax {
16701668
var elements = [RawDeclModifierSyntax]()
16711669

16721670
for _ in 0..<count {

Sources/SwiftSyntax/generated/RenamedChildrenCompatibility.swift

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/raw/RawSyntaxNodesAB.swift

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/raw/RawSyntaxValidation.swift

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxNodesAB.swift

Lines changed: 34 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftSyntaxBuilder/generated/RenamedChildrenBuilderCompatibility.swift

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)