Skip to content

Add a convenience initializer for IfStmt (optionally taking a second trailing builder closure) #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Jul 26, 2022

As proposed in #506 (comment), this adds a new convenience initializer for IfStmt making both if and if-else statements nicely expressible using (multiple) trailing builder closures:

IfStmt(conditions: ...) {
  // if-body
}

IfStmt(conditions: ...) {
  // if-body
} elseBody: {
  // else-body
}

@fwcd fwcd requested a review from ahoppen as a code owner July 26, 2022 14:39
@fwcd
Copy link
Member Author

fwcd commented Jul 26, 2022

@swift-ci please test

@fwcd fwcd force-pushed the if-else-convenience-initializer branch from b18eab1 to 7c03c62 Compare July 26, 2022 14:47
@fwcd
Copy link
Member Author

fwcd commented Jul 26, 2022

@swift-ci please test

@fwcd fwcd merged commit cafd34b into swiftlang:main Jul 26, 2022
@fwcd fwcd deleted the if-else-convenience-initializer branch July 26, 2022 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants