@@ -431,13 +431,6 @@ impl VisitMut for BlockScoping {
431
431
self . handle_capture_of_vars ( & mut node. body ) ;
432
432
}
433
433
434
- fn visit_mut_while_stmt ( & mut self , node : & mut WhileStmt ) {
435
- self . visit_mut_with_scope ( ScopeKind :: new_loop ( ) , & mut node. body ) ;
436
-
437
- node. test . visit_mut_with ( self ) ;
438
- self . handle_capture_of_vars ( & mut node. body ) ;
439
- }
440
-
441
434
fn visit_mut_for_in_stmt ( & mut self , node : & mut ForInStmt ) {
442
435
let blockifyed = self . blockify_for_stmt_body ( & mut node. body ) ;
443
436
let lexical_var = if let ForHead :: VarDecl ( decl) = & node. left {
@@ -544,6 +537,14 @@ impl VisitMut for BlockScoping {
544
537
self . visit_mut_stmt_like ( n) ;
545
538
}
546
539
540
+ fn visit_mut_switch_case ( & mut self , n : & mut SwitchCase ) {
541
+ let old_vars = self . vars . take ( ) ;
542
+
543
+ n. visit_mut_children_with ( self ) ;
544
+
545
+ self . vars = old_vars;
546
+ }
547
+
547
548
fn visit_mut_var_decl ( & mut self , var : & mut VarDecl ) {
548
549
let old = self . var_decl_kind ;
549
550
self . var_decl_kind = var. kind ;
@@ -569,6 +570,13 @@ impl VisitMut for BlockScoping {
569
570
}
570
571
}
571
572
}
573
+
574
+ fn visit_mut_while_stmt ( & mut self , node : & mut WhileStmt ) {
575
+ self . visit_mut_with_scope ( ScopeKind :: new_loop ( ) , & mut node. body ) ;
576
+
577
+ node. test . visit_mut_with ( self ) ;
578
+ self . handle_capture_of_vars ( & mut node. body ) ;
579
+ }
572
580
}
573
581
574
582
impl BlockScoping {
0 commit comments