@@ -14,12 +14,16 @@ import Foundation
14
14
@_spi ( RawSyntax) import SwiftParser
15
15
@_spi ( RawSyntax) import SwiftSyntax
16
16
17
+ // MARK: - BinaryOperatorExpr
18
+
17
19
extension BinaryOperatorExpr {
18
20
public init ( text: String ) {
19
21
self . init ( operatorToken: . spacedBinaryOperator( text) )
20
22
}
21
23
}
22
24
25
+ // MARK: - BooleanLiteralExpr
26
+
23
27
extension BooleanLiteralExpr : ExpressibleByBooleanLiteral {
24
28
public init ( _ value: Bool ) {
25
29
self . init ( booleanLiteral: value ? . true : . false )
@@ -30,6 +34,8 @@ extension BooleanLiteralExpr: ExpressibleByBooleanLiteral {
30
34
}
31
35
}
32
36
37
+ // MARK: - CatchClause
38
+
33
39
extension CatchClause {
34
40
/// A convenience initializer that calculates spacing around the `catch` keyword.
35
41
public init (
@@ -46,6 +52,8 @@ extension CatchClause {
46
52
}
47
53
}
48
54
55
+ // MARK: - CustomAttribute
56
+
49
57
extension CustomAttribute {
50
58
/// A convenience initializer that allows passing in arguments using a result builder
51
59
/// and automatically adds parentheses as needed, similar to the convenience
@@ -64,6 +72,8 @@ extension CustomAttribute {
64
72
}
65
73
}
66
74
75
+ // MARK: - DictionaryExpr
76
+
67
77
extension DictionaryExpr {
68
78
/// A convenience initializer that allows passing in members using a result builder
69
79
/// instead of having to wrap them in a `DictionaryElementList`.
@@ -81,6 +91,8 @@ extension DictionaryExpr {
81
91
}
82
92
}
83
93
94
+ // MARK: - FloatLiteralExprSyntax
95
+
84
96
extension FloatLiteralExprSyntax : ExpressibleByFloatLiteral {
85
97
public init ( _ value: Float ) {
86
98
self . init ( floatingDigits: String ( value) )
@@ -91,6 +103,8 @@ extension FloatLiteralExprSyntax: ExpressibleByFloatLiteral {
91
103
}
92
104
}
93
105
106
+ // MARK: - FunctionCallExpr
107
+
94
108
extension FunctionCallExpr {
95
109
/// A convenience initializer that allows passing in arguments using a result builder
96
110
/// instead of having to wrap them in a `TupleExprElementList`.
@@ -114,6 +128,8 @@ extension FunctionCallExpr {
114
128
}
115
129
}
116
130
131
+ // MARK: - FunctionParameter
132
+
117
133
extension FunctionParameter {
118
134
public init (
119
135
_ source: String ,
@@ -125,6 +141,8 @@ extension FunctionParameter {
125
141
}
126
142
}
127
143
144
+ // MARK: - IfStmt
145
+
128
146
extension IfStmt {
129
147
/// A convenience initializer that uses builder closures to express an
130
148
/// if body, potentially with a second trailing builder closure for an else
@@ -147,6 +165,8 @@ extension IfStmt {
147
165
}
148
166
149
167
168
+ // MARK: - IntegerLiteralExpr
169
+
150
170
extension IntegerLiteralExpr : ExpressibleByIntegerLiteral {
151
171
public init ( _ value: Int ) {
152
172
self . init ( digits: String ( value) )
@@ -157,6 +177,8 @@ extension IntegerLiteralExpr: ExpressibleByIntegerLiteral {
157
177
}
158
178
}
159
179
180
+ // MARK: - MemberAccessExpr
181
+
160
182
extension MemberAccessExpr {
161
183
/// Creates a `MemberAccessExpr` using the provided parameters.
162
184
public init (
@@ -169,6 +191,8 @@ extension MemberAccessExpr {
169
191
}
170
192
}
171
193
194
+ // MARK: - StringLiteralExpr
195
+
172
196
extension StringLiteralExpr {
173
197
/// A regular expression matching sequences of `#`s with an adjacent quote or
174
198
/// interpolation. Used to determine the number of `#`s for a raw string literal.
@@ -220,13 +244,17 @@ extension StringLiteralExpr {
220
244
}
221
245
}
222
246
247
+ // MARK: - SwitchCase
248
+
223
249
extension SwitchCase {
224
250
public init ( _ label: String , @CodeBlockItemListBuilder statementsBuilder: ( ) -> CodeBlockItemListSyntax ) {
225
251
self . init ( " \( label) " )
226
252
self . statements = statementsBuilder ( )
227
253
}
228
254
}
229
255
256
+ // MARK: - TernaryExpr
257
+
230
258
extension TernaryExpr {
231
259
public init (
232
260
if condition: ExprSyntaxProtocol ,
@@ -243,6 +271,8 @@ extension TernaryExpr {
243
271
}
244
272
}
245
273
274
+ // MARK: - TupleExprElement
275
+
246
276
extension TupleExprElement {
247
277
/// A convenience initializer that allows passing in label as an optional string.
248
278
/// The presence of the colon will be inferred based on the presence of the label.
@@ -252,6 +282,8 @@ extension TupleExprElement {
252
282
}
253
283
}
254
284
285
+ // MARK: - VariableDecl
286
+
255
287
extension VariableDecl {
256
288
/// Creates an optionally initialized property.
257
289
public init (
0 commit comments