File tree 5 files changed +66
-0
lines changed
tests/fixture/issues/9739
5 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ swc_core : patch
3
+ swc_ecma_minifier : patch
4
+ ---
5
+
6
+ fix(es/minifier): Do not inline into the exact LHS
Original file line number Diff line number Diff line change @@ -789,6 +789,10 @@ impl Optimizer<'_> {
789
789
790
790
/// Actually inlines variables.
791
791
pub ( super ) fn inline ( & mut self , e : & mut Expr ) {
792
+ if self . ctx . is_exact_lhs_of_assign {
793
+ return ;
794
+ }
795
+
792
796
match e {
793
797
Expr :: Member ( me) => {
794
798
if let MemberProp :: Computed ( prop) = & mut me. prop {
Original file line number Diff line number Diff line change
1
+ {
2
+ "arguments" : false ,
3
+ "arrows" : true ,
4
+ "booleans" : true ,
5
+ "booleans_as_integers" : false ,
6
+ "collapse_vars" : true ,
7
+ "comparisons" : true ,
8
+ "computed_props" : true ,
9
+ "conditionals" : true ,
10
+ "dead_code" : true ,
11
+ "directives" : true ,
12
+ "drop_console" : false ,
13
+ "drop_debugger" : true ,
14
+ "evaluate" : true ,
15
+ "expression" : false ,
16
+ "hoist_funs" : false ,
17
+ "hoist_props" : true ,
18
+ "hoist_vars" : false ,
19
+ "if_return" : true ,
20
+ "join_vars" : true ,
21
+ "keep_classnames" : false ,
22
+ "keep_fargs" : true ,
23
+ "keep_fnames" : false ,
24
+ "keep_infinity" : false ,
25
+ "loops" : true ,
26
+ "negate_iife" : true ,
27
+ "properties" : true ,
28
+ "reduce_funcs" : false ,
29
+ "reduce_vars" : false ,
30
+ "side_effects" : true ,
31
+ "switches" : true ,
32
+ "typeofs" : true ,
33
+ "unsafe" : false ,
34
+ "unsafe_arrows" : false ,
35
+ "unsafe_comps" : false ,
36
+ "unsafe_Function" : false ,
37
+ "unsafe_math" : false ,
38
+ "unsafe_symbols" : false ,
39
+ "unsafe_methods" : false ,
40
+ "unsafe_proto" : false ,
41
+ "unsafe_regexp" : false ,
42
+ "unsafe_undefined" : false ,
43
+ "unused" : true ,
44
+ "const_to_let" : true ,
45
+ "pristine_globals" : true
46
+ }
Original file line number Diff line number Diff line change
1
+ const arr = [ 'a' , 'b' ] ;
2
+ [ arr [ 0 ] , arr [ 1 ] ] = [ arr [ 1 ] , arr [ 0 ] ] ;
Original file line number Diff line number Diff line change
1
+ const arr = [
2
+ 'a' ,
3
+ 'b'
4
+ ] ;
5
+ [ arr [ 0 ] , arr [ 1 ] ] = [
6
+ 'b' ,
7
+ 'a'
8
+ ] ;
You can’t perform that action at this time.
0 commit comments