@@ -1140,9 +1140,8 @@ bool Converter::VisitCXXForRangeStmtIndexBased(clang::CXXForRangeStmt *stmt,
11401140}
11411141
11421142bool Converter::VisitBreakStmt ([[maybe_unused]] clang::BreakStmt *stmt) {
1143- if (break_target_stack_.isRegularSwitch ()) {
1144- StrCat (keyword::kBreak );
1145- StrCat (" 'switch" );
1143+ if (break_target_stack_.isSwitch ()) {
1144+ StrCat (keyword::kBreak , " 'switch" );
11461145 return false ;
11471146 }
11481147 StrCat (keyword::kBreak );
@@ -2652,20 +2651,12 @@ bool Converter::VisitSwitchStmt(clang::SwitchStmt *stmt) {
26522651 auto *body = clang::dyn_cast<clang::CompoundStmt>(stmt->getBody ());
26532652 assert (body);
26542653
2655- bool has_fallthrough = SwitchHasFallthrough (stmt);
2656-
2657- if (has_fallthrough) {
2658- StrCat (" switch!(match " , ToString (stmt->getCond ()), " {" );
2659- } else {
2660- StrCat (" 'switch: {" );
2661- StrCat (std::format (" let __match_cond = {};" , ToString (stmt->getCond ())));
2662- StrCat (" match __match_cond" );
2663- StrCat (" {" );
2664- }
2654+ StrCat (" 'switch: {" );
2655+ StrCat (std::format (" let __match_cond = {};" , ToString (stmt->getCond ())));
2656+ StrCat (" match __match_cond" );
2657+ StrCat (" {" );
26652658
2666- PushBreakTarget push (break_target_stack_, has_fallthrough
2667- ? BreakTarget::FallthroughSwitch
2668- : BreakTarget::RegularSwitch);
2659+ PushBreakTarget push (break_target_stack_, BreakTarget::Switch);
26692660
26702661 clang::SwitchCase *default_case = nullptr ;
26712662 for (auto *sc : GetTopLevelSwitchCases (stmt)) {
@@ -2691,12 +2682,8 @@ bool Converter::VisitSwitchStmt(clang::SwitchStmt *stmt) {
26912682 StrCat (R"( _ => {})" );
26922683 }
26932684
2694- if (has_fallthrough) {
2695- StrCat (" })" );
2696- } else {
2697- StrCat (" }" );
2698- StrCat (" }" );
2699- }
2685+ StrCat (" }" );
2686+ StrCat (" }" );
27002687 return false ;
27012688}
27022689
0 commit comments