File tree Expand file tree Collapse file tree 2 files changed +35
-6
lines changed
Expand file tree Collapse file tree 2 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -479,13 +479,25 @@ impl Visit for Analyzer<'_> {
479479 . iter ( )
480480 . filter_map ( |case| self . get_end_reason ( case. start ( ) ) )
481481 . try_fold (
482- End :: Forced {
483- ret : false ,
484- throw : false ,
485- infinite_loop : false ,
482+ (
483+ End :: Forced {
484+ ret : false ,
485+ throw : false ,
486+ infinite_loop : false ,
487+ } ,
488+ // record if previous is continue
489+ false ,
490+ ) ,
491+ |acc, cur| {
492+ if matches ! ( cur, End :: Continue ) {
493+ Some ( ( acc. 0 , true ) )
494+ } else {
495+ acc. 0 . merge_forced ( cur) . map ( |acc| ( acc, false ) )
496+ }
486497 } ,
487- |acc, cur| acc. merge_forced ( cur) ,
488- ) ;
498+ )
499+ // None if last is continue
500+ . and_then ( |( acc, last_continue) | ( !last_continue) . then_some ( acc) ) ;
489501
490502 match forced_end {
491503 Some ( e) if has_default => e,
Original file line number Diff line number Diff line change @@ -191,6 +191,23 @@ switch(someValue) {
191191 console.log(42);
192192}
193193 "# ,
194+ r#"
195+ switch(foo) {
196+ case true:
197+ switch (bar) {
198+ case true:
199+ default:
200+ return true;
201+ }
202+ default:
203+ switch (bar) {
204+ case true:
205+ return true;
206+ default:
207+ return false;
208+ }
209+ }
210+ "#
194211 } ;
195212 }
196213
You can’t perform that action at this time.
0 commit comments