File tree 1 file changed +25
-8
lines changed
crates/swc_ecma_minifier/src/compress/pure
1 file changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,15 @@ impl Pure<'_> {
181
181
node. visit_mut_with ( v) ;
182
182
} ) ;
183
183
}
184
+
185
+ fn visit_par_ref < N > ( & mut self , nodes : & mut [ & mut N ] )
186
+ where
187
+ N : for < ' aa > VisitMutWith < Pure < ' aa > > + Send + Sync ,
188
+ {
189
+ self . maybe_par ( 0 , nodes, |v, node| {
190
+ node. visit_mut_with ( v) ;
191
+ } ) ;
192
+ }
184
193
}
185
194
186
195
impl VisitMut for Pure < ' _ > {
@@ -706,16 +715,24 @@ impl VisitMut for Pure<'_> {
706
715
fn visit_mut_if_stmt ( & mut self , s : & mut IfStmt ) {
707
716
s. test . visit_mut_with ( self ) ;
708
717
709
- {
710
- let ctx = Ctx {
711
- preserve_block : false ,
712
- ..self . ctx
713
- } ;
714
- s. cons . visit_mut_with ( & mut * self . with_ctx ( ctx) ) ;
718
+ match & mut s. alt {
719
+ Some ( alt) => {
720
+ let ctx = Ctx {
721
+ preserve_block : false ,
722
+ ..self . ctx
723
+ } ;
724
+ self . with_ctx ( ctx)
725
+ . visit_par_ref ( & mut [ & mut * s. cons , & mut * * alt] ) ;
726
+ }
727
+ None => {
728
+ let ctx = Ctx {
729
+ preserve_block : false ,
730
+ ..self . ctx
731
+ } ;
732
+ s. cons . visit_mut_with ( & mut * self . with_ctx ( ctx) ) ;
733
+ }
715
734
}
716
735
717
- s. alt . visit_mut_with ( self ) ;
718
-
719
736
self . optimize_expr_in_bool_ctx ( & mut s. test , false ) ;
720
737
721
738
self . merge_else_if ( s) ;
You can’t perform that action at this time.
0 commit comments