Skip to content

Commit 6cd8020

Browse files
committed
Add MARK annotations to ConvenienceInitializers.swift
1 parent fa34bdb commit 6cd8020

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
/// A regular expression matching sequences of `#`s with an adjacent quote or
174198
/// interpolation. Used to determine the number of `#`s for a raw string literal.
@@ -220,13 +244,17 @@ extension StringLiteralExpr {
220244
}
221245
}
222246

247+
// MARK: - SwitchCase
248+
223249
extension SwitchCase {
224250
public init(_ label: String, @CodeBlockItemListBuilder statementsBuilder: () -> CodeBlockItemListSyntax) {
225251
self.init("\(label)")
226252
self.statements = statementsBuilder()
227253
}
228254
}
229255

256+
// MARK: - TernaryExpr
257+
230258
extension TernaryExpr {
231259
public init(
232260
if condition: ExprSyntaxProtocol,
@@ -243,6 +271,8 @@ extension TernaryExpr {
243271
}
244272
}
245273

274+
// MARK: - TupleExprElement
275+
246276
extension TupleExprElement {
247277
/// A convenience initializer that allows passing in label as an optional string.
248278
/// The presence of the colon will be inferred based on the presence of the label.
@@ -252,6 +282,8 @@ extension TupleExprElement {
252282
}
253283
}
254284

285+
// MARK: - VariableDecl
286+
255287
extension VariableDecl {
256288
/// Creates an optionally initialized property.
257289
public init(

0 commit comments

Comments
 (0)