File tree Expand file tree Collapse file tree 2 files changed +0
-47
lines changed
Sources/SwiftSyntaxBuilder
Tests/SwiftSyntaxBuilderTest Expand file tree Collapse file tree 2 files changed +0
-47
lines changed Original file line number Diff line number Diff line change @@ -186,29 +186,6 @@ extension FunctionParameterSyntax {
186
186
}
187
187
}
188
188
189
- // MARK: - IfStmt
190
-
191
- extension IfStmtSyntax {
192
- /// A convenience initializer that uses builder closures to express an
193
- /// if body, potentially with a second trailing builder closure for an else
194
- /// body.
195
- public init (
196
- leadingTrivia: Trivia = [ ] ,
197
- conditions: ConditionElementListSyntax ,
198
- @CodeBlockItemListBuilder body: ( ) -> CodeBlockItemListSyntax ,
199
- @CodeBlockItemListBuilder elseBody: ( ) -> CodeBlockItemListSyntax ? = { nil }
200
- ) {
201
- let generatedElseBody = elseBody ( )
202
- self . init (
203
- leadingTrivia: leadingTrivia,
204
- conditions: conditions,
205
- body: CodeBlockSyntax ( statements: body ( ) ) ,
206
- elseKeyword: generatedElseBody == nil ? nil : . keyword( . else, leadingTrivia: . space) ,
207
- elseBody: generatedElseBody. map { . codeBlock( CodeBlockSyntax ( statements: $0) ) }
208
- )
209
- }
210
- }
211
-
212
189
// MARK: - IntegerLiteralExpr
213
190
214
191
extension IntegerLiteralExprSyntax : ExpressibleByIntegerLiteral {
Original file line number Diff line number Diff line change @@ -114,30 +114,6 @@ final class IfStmtTests: XCTestCase {
114
114
}
115
115
}
116
116
117
- func testIfElseStmt( ) {
118
- // Use the convenience initializer from IfStmtConvenienceInitializers
119
- // with an else branch expressed by a second trailing closure.
120
- let buildable = IfStmtSyntax ( conditions: ConditionElementListSyntax { BooleanLiteralExprSyntax ( true ) } ) {
121
- FunctionCallExprSyntax ( callee: ExprSyntax ( " print " ) ) {
122
- TupleExprElementSyntax ( expression: StringLiteralExprSyntax ( content: " Hello from the if-branch! " ) )
123
- }
124
- } elseBody: {
125
- FunctionCallExprSyntax ( callee: ExprSyntax ( " print " ) ) {
126
- TupleExprElementSyntax ( expression: StringLiteralExprSyntax ( content: " Hello from the else-branch! " ) )
127
- }
128
- }
129
- AssertBuildResult (
130
- buildable,
131
- """
132
- if true {
133
- print( " Hello from the if-branch! " )
134
- } else {
135
- print( " Hello from the else-branch! " )
136
- }
137
- """
138
- )
139
- }
140
-
141
117
func testIfLetStmt( ) {
142
118
let buildable = IfStmtSyntax (
143
119
conditions: ConditionElementListSyntax {
You can’t perform that action at this time.
0 commit comments