Skip to content

Commit c8e01b5

Browse files
committed
[Typed throws] Add thrown type to effect specifiers
1 parent ad237ff commit c8e01b5

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

CodeGeneration/Sources/SyntaxSupport/CommonNodes.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,27 @@ public let COMMON_NODES: [Node] = [
7777
]
7878
),
7979

80+
Node(
81+
kind: .thrownType,
82+
base: .syntax,
83+
nameForDiagnostics: "thrown type",
84+
children: [
85+
Child(
86+
name: "leftParen",
87+
kind: .token(choices: [.token(.leftParen)])
88+
),
89+
Child(
90+
name: "type",
91+
kind: .node(kind: .type),
92+
nameForDiagnostics: "type"
93+
),
94+
Child(
95+
name: "rightParen",
96+
kind: .token(choices: [.token(.rightParen)])
97+
),
98+
]
99+
),
100+
80101
Node(
81102
kind: .accessorEffectSpecifiers,
82103
base: .syntax,
@@ -95,6 +116,11 @@ public let COMMON_NODES: [Node] = [
95116
kind: .token(choices: [.keyword(.throws)]),
96117
isOptional: true
97118
),
119+
Child(
120+
name: "thrownType",
121+
kind: .node(kind: .thrownType),
122+
isOptional: true
123+
),
98124
]
99125
),
100126

@@ -116,6 +142,11 @@ public let COMMON_NODES: [Node] = [
116142
kind: .token(choices: [.keyword(.throws), .keyword(.rethrows)]),
117143
isOptional: true
118144
),
145+
Child(
146+
name: "thrownType",
147+
kind: .node(kind: .thrownType),
148+
isOptional: true
149+
),
119150
]
120151
),
121152

@@ -317,6 +348,11 @@ public let COMMON_NODES: [Node] = [
317348
kind: .token(choices: [.keyword(.throws)]),
318349
isOptional: true
319350
),
351+
Child(
352+
name: "thrownType",
353+
kind: .node(kind: .thrownType),
354+
isOptional: true
355+
),
320356
]
321357
),
322358

CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ public enum SyntaxNodeKind: String, CaseIterable {
268268
case switchExpr
269269
case ternaryExpr
270270
case thenStmt
271+
case thrownType
271272
case throwStmt
272273
case tryExpr
273274
case tupleExpr

CodeGeneration/Sources/SyntaxSupport/Traits.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ public let TRAITS: [Trait] = [
5656
Child(name: "asyncSpecifier", kind: .token(choices: [.keyword(.async), .keyword(.reasync)]), isOptional: true),
5757
Child(name: "unexpectedBetweenAsyncSpecifierAndThrowsSpecifier", kind: .node(kind: .unexpectedNodes), isOptional: true),
5858
Child(name: "throwsSpecifier", kind: .token(choices: [.keyword(.throws), .keyword(.rethrows)]), isOptional: true),
59-
Child(name: "unexpectedAfterThrowsSpecifier", kind: .node(kind: .unexpectedNodes), isOptional: true),
59+
Child(name: "unexpectedBetweenThrowsSpecifierAndThrownType", kind: .node(kind: .unexpectedNodes), isOptional: true),
60+
Child(
61+
name: "thrownType",
62+
kind: .node(kind: .thrownType),
63+
isOptional: true
64+
),
65+
Child(name: "unexpectedAfterThrownType", kind: .node(kind: .unexpectedNodes), isOptional: true),
6066
]
6167
),
6268
Trait(

0 commit comments

Comments
 (0)