@@ -2826,7 +2826,7 @@ export class Compiler extends DiagnosticEmitter {
2826
2826
// nest blocks in order
2827
2827
let currentBlock = module . block ( `case0|${ context } ` , breaks , TypeRef . None ) ;
2828
2828
let fallThroughFlow : Flow | null = null ;
2829
- let commonBreakingFlow : Flow | null = null ;
2829
+ let mutualBreakingFlow : Flow | null = null ;
2830
2830
for ( let i = 0 ; i < numCases ; ++ i ) {
2831
2831
let case_ = cases [ i ] ;
2832
2832
let statements = case_ . statements ;
@@ -2860,21 +2860,21 @@ export class Compiler extends DiagnosticEmitter {
2860
2860
let possiblyBreaks = innerFlow . isAny ( FlowFlags . Breaks | FlowFlags . ConditionallyBreaks ) ;
2861
2861
innerFlow . unset ( FlowFlags . Breaks | FlowFlags . ConditionallyBreaks ) ; // clear
2862
2862
if ( possiblyBreaks || ( isLast && possiblyFallsThrough ) ) {
2863
- if ( commonBreakingFlow ) commonBreakingFlow . inheritBranch ( innerFlow ) ;
2864
- else commonBreakingFlow = innerFlow ;
2863
+ if ( mutualBreakingFlow ) mutualBreakingFlow . inheritMutual ( mutualBreakingFlow , innerFlow ) ;
2864
+ else mutualBreakingFlow = innerFlow ;
2865
2865
}
2866
2866
this . currentFlow = outerFlow ;
2867
2867
currentBlock = module . block ( nextLabel , stmts , TypeRef . None ) ; // must be a labeled block
2868
2868
}
2869
2869
outerFlow . popBreakLabel ( ) ;
2870
2870
2871
- // If the switch has a default, we only get past through a breaking flow
2871
+ // If the switch has a default, we only get past through any breaking flow
2872
2872
if ( defaultIndex >= 0 ) {
2873
- if ( commonBreakingFlow ) outerFlow . inherit ( commonBreakingFlow ) ;
2873
+ if ( mutualBreakingFlow ) outerFlow . inherit ( mutualBreakingFlow ) ;
2874
2874
else outerFlow . set ( FlowFlags . Terminates ) ;
2875
2875
// Otherwise either skipping or any breaking flow can get past
2876
- } else if ( commonBreakingFlow ) {
2877
- outerFlow . inheritBranch ( commonBreakingFlow ) ;
2876
+ } else if ( mutualBreakingFlow ) {
2877
+ outerFlow . inheritBranch ( mutualBreakingFlow ) ;
2878
2878
}
2879
2879
return currentBlock ;
2880
2880
}
0 commit comments