You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Constructs a syntax node where `header` builds the text of the node before the body in braces and `bodyBuilder` is used to build the node’s body.
44
+
///
45
+
/// For example, you can construct
46
+
///
47
+
/// ```swift
48
+
/// while x < 5 {
49
+
/// x += 1
50
+
/// }
51
+
/// ```
52
+
///
53
+
/// using this call
54
+
///
55
+
/// ```swift
56
+
/// try WhileStmtSyntax("while x < 5") {
57
+
/// ExprSyntax("x += 1")
58
+
/// }
59
+
/// ```
60
+
///
61
+
/// Throws an error if `header` defines a different node type than the type the initializer is called on. E.g. if calling `try IfStmtSyntax("while x < 5") {}`
/// Throws an error if `header` defines a different node type than the type the initializer is called on. E.g. if calling `try FunctionDeclSyntax("init") {}`
/// Constructs a syntax node where `header` builds the text of the node before the members in braces and `membersBuilder` is used to list the node’s members.
137
+
///
138
+
/// For example, you can construct
139
+
///
140
+
/// ```swift
141
+
/// struct Point {
142
+
/// var x: Int
143
+
/// var y: Int
144
+
/// }
145
+
/// ```
146
+
///
147
+
/// using this call
148
+
///
149
+
/// ```swift
150
+
/// try StructDeclSyntax("struct Point") {
151
+
/// DeclSyntax("var x: Int")
152
+
/// DeclSyntax("var y: Int")
153
+
/// }
154
+
/// ```
155
+
///
156
+
/// Throws an error if `header` defines a different node type than the type the initializer is called on. E.g. if calling `try StructDeclSyntax("class MyClass") {}`
@@ -147,6 +257,24 @@ public extension IfExprSyntax {
147
257
// MARK: - SwitchCase
148
258
149
259
extensionSwitchCaseSyntax{
260
+
/// Constructs a case item where `header` includes the text between the `case` keyword and the `:` (both inclusive) and `statementsBuilder` can be used to build the statements inside the case item.
261
+
///
262
+
/// For example, you can construct
263
+
///
264
+
/// ```swift
265
+
/// default:
266
+
/// return nil
267
+
/// ```
268
+
///
269
+
/// using this call
270
+
///
271
+
/// ```swift
272
+
/// try SwitchCaseSyntax("default:") {
273
+
/// StmtSyntax("return")
274
+
/// }
275
+
/// ```
276
+
///
277
+
/// Throws an error if `header` does not start a switch case item. E.g. if calling `try SwitchCaseSyntax("func foo") {}`
0 commit comments