Skip to content

Commit 8e1c49c

Browse files
committed
Add MARK annotations to ConvenienceInitializers.swift
1 parent d72e873 commit 8e1c49c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Sources/SwiftSyntaxBuilder/ConvenienceInitializers.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ import Foundation
1414
@_spi(RawSyntax) import SwiftParser
1515
@_spi(RawSyntax) import SwiftSyntax
1616

17+
// MARK: - BinaryOperatorExpr
18+
1719
extension BinaryOperatorExpr {
1820
public init(text: String) {
1921
self.init(operatorToken: .spacedBinaryOperator(text))
2022
}
2123
}
2224

25+
// MARK: - BooleanLiteralExpr
26+
2327
extension BooleanLiteralExpr: ExpressibleByBooleanLiteral {
2428
public init(_ value: Bool) {
2529
self.init(booleanLiteral: value ? .true : .false)
@@ -30,6 +34,8 @@ extension BooleanLiteralExpr: ExpressibleByBooleanLiteral {
3034
}
3135
}
3236

37+
// MARK: - CatchClause
38+
3339
extension CatchClause {
3440
/// A convenience initializer that calculates spacing around the `catch` keyword.
3541
public init(
@@ -46,6 +52,8 @@ extension CatchClause {
4652
}
4753
}
4854

55+
// MARK: - CustomAttribute
56+
4957
extension CustomAttribute {
5058
/// A convenience initializer that allows passing in arguments using a result builder
5159
/// and automatically adds parentheses as needed, similar to the convenience
@@ -64,6 +72,8 @@ extension CustomAttribute {
6472
}
6573
}
6674

75+
// MARK: - DictionaryExpr
76+
6777
extension DictionaryExpr {
6878
/// A convenience initializer that allows passing in members using a result builder
6979
/// instead of having to wrap them in a `DictionaryElementList`.
@@ -81,6 +91,8 @@ extension DictionaryExpr {
8191
}
8292
}
8393

94+
// MARK: - FloatLiteralExprSyntax
95+
8496
extension FloatLiteralExprSyntax: ExpressibleByFloatLiteral {
8597
public init(_ value: Float) {
8698
self.init(floatingDigits: String(value))
@@ -91,6 +103,8 @@ extension FloatLiteralExprSyntax: ExpressibleByFloatLiteral {
91103
}
92104
}
93105

106+
// MARK: - FunctionCallExpr
107+
94108
extension FunctionCallExpr {
95109
/// A convenience initializer that allows passing in arguments using a result builder
96110
/// instead of having to wrap them in a `TupleExprElementList`.
@@ -114,6 +128,8 @@ extension FunctionCallExpr {
114128
}
115129
}
116130

131+
// MARK: - FunctionParameter
132+
117133
extension FunctionParameter {
118134
public init(
119135
_ source: String,
@@ -125,6 +141,8 @@ extension FunctionParameter {
125141
}
126142
}
127143

144+
// MARK: - IfStmt
145+
128146
extension IfStmt {
129147
/// A convenience initializer that uses builder closures to express an
130148
/// if body, potentially with a second trailing builder closure for an else
@@ -147,6 +165,8 @@ extension IfStmt {
147165
}
148166

149167

168+
// MARK: - IntegerLiteralExpr
169+
150170
extension IntegerLiteralExpr: ExpressibleByIntegerLiteral {
151171
public init(_ value: Int) {
152172
self.init(digits: String(value))
@@ -157,6 +177,8 @@ extension IntegerLiteralExpr: ExpressibleByIntegerLiteral {
157177
}
158178
}
159179

180+
// MARK: - MemberAccessExpr
181+
160182
extension MemberAccessExpr {
161183
/// Creates a `MemberAccessExpr` using the provided parameters.
162184
public init(
@@ -169,6 +191,8 @@ extension MemberAccessExpr {
169191
}
170192
}
171193

194+
// MARK: - StringLiteralExpr
195+
172196
extension StringLiteralExpr {
173197
private enum PoundState {
174198
case afterQuote, afterBackslash, none
@@ -244,13 +268,17 @@ extension StringLiteralExpr {
244268
}
245269
}
246270

271+
// MARK: - SwitchCase
272+
247273
extension SwitchCase {
248274
public init(_ label: String, @CodeBlockItemListBuilder statementsBuilder: () -> CodeBlockItemListSyntax) {
249275
self.init("\(label)")
250276
self.statements = statementsBuilder()
251277
}
252278
}
253279

280+
// MARK: - TernaryExpr
281+
254282
extension TernaryExpr {
255283
public init(
256284
if condition: ExprSyntaxProtocol,
@@ -267,6 +295,8 @@ extension TernaryExpr {
267295
}
268296
}
269297

298+
// MARK: - TupleExprElement
299+
270300
extension TupleExprElement {
271301
/// A convenience initializer that allows passing in label as an optional string.
272302
/// The presence of the colon will be inferred based on the presence of the label.
@@ -276,6 +306,8 @@ extension TupleExprElement {
276306
}
277307
}
278308

309+
// MARK: - VariableDecl
310+
279311
extension VariableDecl {
280312
/// Creates an optionally initialized property.
281313
public init(

0 commit comments

Comments
 (0)