Skip to content

[gardening] Slim down StmtChecker::visitSwitchStmt even more #23334

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

Conversation

gottesmm
Copy link
Contributor

I just extracted out subroutines using Xcode's refactoring engine. Should be NFC.

Now one can actually read StmtChecker::visitSwitchStmt without getting lost since it is more compact.

…n helper method.

The method StmtChecker::visitSwitchStmt is really large and does a bunch of
different things. This implicit submethod was one of the largest of these. By
extracting this, we make the original method easier to reason about.

Extracting done with Xcode's refactoring engine.
…types into its own helper method.

This is the last "subroutine" I am extracting from StmtChecker::visitSwitchStmt.
It is possible to read easily now without getting lost.
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@@ -947,6 +947,142 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
return S;
}

void checkCaseLabelItem(CaseStmt *caseBlock, CaseLabelItem &labelItem,
bool &limitExhaustivityChecks, Type subjectType) {
SWIFT_DEFER {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually going to rip out the usage of SWIFT_DEFER here in a subsequent commit and hoist it back into visitSwitchStmt. I just don't want to stop the testing now.

@swift-ci swift-ci merged commit 4d7d2ef into swiftlang:master Mar 15, 2019
@gottesmm gottesmm deleted the pr-cafc42f13f3d474469835f12b2fdc97e9c947c76 branch March 15, 2019 20:36
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