13
13
@_spi ( RawSyntax) import SwiftParser
14
14
@_spi ( RawSyntax) import SwiftSyntax
15
15
16
- // MARK: - ArrayElementList
16
+ // MARK: - ArrayElementListSyntax
17
17
18
18
extension ArrayElementListSyntax {
19
19
public init ( expressions: [ ExprSyntax ] ) {
@@ -30,15 +30,15 @@ extension ArrayElementListSyntax {
30
30
}
31
31
}
32
32
33
- // MARK: - ArrayExpr
33
+ // MARK: - ArrayExprSyntax
34
34
35
35
extension ArrayExprSyntax {
36
36
public init ( expressions: [ ExprSyntax ] ) {
37
37
self . init ( elements: ArrayElementListSyntax ( expressions: expressions) )
38
38
}
39
39
}
40
40
41
- // MARK: - CustomAttribute
41
+ // MARK: - AttributeSyntax
42
42
43
43
extension AttributeSyntax {
44
44
/// A convenience initializer that allows passing in arguments using a result builder
@@ -58,15 +58,15 @@ extension AttributeSyntax {
58
58
}
59
59
}
60
60
61
- // MARK: - BinaryOperatorExpr
61
+ // MARK: - BinaryOperatorExprSyntax
62
62
63
63
extension BinaryOperatorExprSyntax {
64
64
public init ( text: String ) {
65
65
self . init ( operator: . binaryOperator( text) )
66
66
}
67
67
}
68
68
69
- // MARK: - BooleanLiteralExpr
69
+ // MARK: - BooleanLiteralExprSyntax
70
70
71
71
extension BooleanLiteralExprSyntax : ExpressibleByBooleanLiteral {
72
72
public init ( _ value: Bool ) {
@@ -78,7 +78,7 @@ extension BooleanLiteralExprSyntax: ExpressibleByBooleanLiteral {
78
78
}
79
79
}
80
80
81
- // MARK: - CatchClause
81
+ // MARK: - CatchClauseSyntax
82
82
83
83
extension CatchClauseSyntax {
84
84
/// A convenience initializer that calculates spacing around the `catch` keyword.
@@ -96,7 +96,7 @@ extension CatchClauseSyntax {
96
96
}
97
97
}
98
98
99
- // MARK: - DictionaryExpr
99
+ // MARK: - DictionaryExprSyntax
100
100
101
101
extension DictionaryExprSyntax {
102
102
/// A convenience initializer that allows passing in members using a result builder
@@ -115,7 +115,15 @@ extension DictionaryExprSyntax {
115
115
}
116
116
}
117
117
118
- // MARK: - Expr
118
+ // MARK: - ExprListSyntax
119
+
120
+ extension ExprListSyntax {
121
+ public init ( _ elements: [ ExprSyntaxProtocol ] ) {
122
+ self . init ( elements. map { ExprSyntax ( fromProtocol: $0) } as [ ExprSyntax ] )
123
+ }
124
+ }
125
+
126
+ // MARK: - ExprSyntax
119
127
120
128
extension ExprSyntax {
121
129
/// Returns a syntax tree for an expression that represents the value of the
@@ -163,7 +171,7 @@ extension FloatLiteralExprSyntax: ExpressibleByFloatLiteral {
163
171
}
164
172
}
165
173
166
- // MARK: - FunctionCallExpr
174
+ // MARK: - FunctionCallExprSyntax
167
175
168
176
extension FunctionCallExprSyntax {
169
177
/// A convenience initializer that allows passing in arguments using a result builder
@@ -188,7 +196,7 @@ extension FunctionCallExprSyntax {
188
196
}
189
197
}
190
198
191
- // MARK: - IntegerLiteralExpr
199
+ // MARK: - IntegerLiteralExprSyntax
192
200
193
201
extension IntegerLiteralExprSyntax : ExpressibleByIntegerLiteral {
194
202
public init ( _ value: Int ) {
@@ -200,7 +208,21 @@ extension IntegerLiteralExprSyntax: ExpressibleByIntegerLiteral {
200
208
}
201
209
}
202
210
203
- // MARK: - StringLiteralExpr
211
+ // MARK: - LabeledExprSyntax
212
+
213
+ extension LabeledExprSyntax {
214
+ /// A convenience initializer that allows passing in label as an optional string.
215
+ /// The presence of the colon will be inferred based on the presence of the label.
216
+ public init ( label: String ? = nil , expression: some ExprSyntaxProtocol ) {
217
+ self . init (
218
+ label: label. map { . identifier( $0) } ,
219
+ colon: label == nil ? nil : . colonToken( trailingTrivia: . space) ,
220
+ expression: expression
221
+ )
222
+ }
223
+ }
224
+
225
+ // MARK: - StringLiteralExprSyntax
204
226
205
227
extension String {
206
228
/// Replace literal newlines with "\r", "\n", "\u{2028}", and ASCII control characters with "\0", "\u{7}"
@@ -338,21 +360,15 @@ extension StringLiteralExprSyntax {
338
360
}
339
361
}
340
362
341
- // MARK: - TupleExprElement
363
+ // MARK: - UnexpectedNodesSyntax
342
364
343
- extension LabeledExprSyntax {
344
- /// A convenience initializer that allows passing in label as an optional string.
345
- /// The presence of the colon will be inferred based on the presence of the label.
346
- public init ( label: String ? = nil , expression: some ExprSyntaxProtocol ) {
347
- self . init (
348
- label: label. map { . identifier( $0) } ,
349
- colon: label == nil ? nil : . colonToken( trailingTrivia: . space) ,
350
- expression: expression
351
- )
365
+ extension UnexpectedNodesSyntax {
366
+ public init ( _ elements: [ SyntaxProtocol ] ) {
367
+ self . init ( elements. map { Syntax ( fromProtocol: $0) } as [ Syntax ] )
352
368
}
353
369
}
354
370
355
- // MARK: - VariableDecl
371
+ // MARK: - VariableDeclSyntax
356
372
357
373
extension VariableDeclSyntax {
358
374
/// Creates an optionally initialized property.
0 commit comments