File tree Expand file tree Collapse file tree 5 files changed +61
-6
lines changed Expand file tree Collapse file tree 5 files changed +61
-6
lines changed Original file line number Diff line number Diff line change @@ -8284,6 +8284,7 @@ Compressor.prototype.compress = function(node) {
8284
8284
if (prop instanceof AST_Spread) return prop;
8285
8285
var key = prop_keys[index];
8286
8286
if (key instanceof AST_Node) return prop;
8287
+ if (key === "__proto__") return prop;
8287
8288
if (drop_keys.has(key)) {
8288
8289
var mapped = drop_keys.get(key);
8289
8290
if (!mapped) return prop;
@@ -8317,7 +8318,10 @@ Compressor.prototype.compress = function(node) {
8317
8318
if (value.has_side_effects(compressor) && prop.value.match_symbol(function(node) {
8318
8319
return node instanceof AST_PropAccess;
8319
8320
})) break;
8320
- value = make_node(AST_Sub, node, {
8321
+ value = is_identifier_string(prop.key) ? make_node(AST_Dot, node, {
8322
+ expression: value,
8323
+ property: prop.key,
8324
+ }) : make_node(AST_Sub, node, {
8321
8325
expression: value,
8322
8326
property: make_node_from_constant(prop.key, prop),
8323
8327
});
Original file line number Diff line number Diff line change @@ -2293,7 +2293,7 @@ issue_5340_3: {
2293
2293
}
2294
2294
expect: {
2295
2295
var a ;
2296
- ( function ( ) { } ) ( a = true [ "p" ] ) ;
2296
+ ( function ( ) { } ) ( a = true . p ) ;
2297
2297
console . log ( a ) ;
2298
2298
}
2299
2299
expect_stdout: "undefined"
Original file line number Diff line number Diff line change @@ -1382,7 +1382,7 @@ side_effects_object: {
1382
1382
}
1383
1383
}
1384
1384
expect: {
1385
- var a = null , c = ( console , 42 [ "c" ] ) ;
1385
+ var a = null , c = ( console , 42. . c ) ;
1386
1386
try {
1387
1387
c [ a = "PASS" ] ;
1388
1388
} catch ( e ) {
@@ -1684,7 +1684,7 @@ singleton_1: {
1684
1684
expect: {
1685
1685
var b , a = "P" [ 0 ] , o = { } ;
1686
1686
o . p = [ "FAIL" [ "1" ] ] [ 0 ] ;
1687
- o . q = { foo : "S" [ 0 ] } [ " foo" ] ;
1687
+ o . q = { foo : "S" [ 0 ] } . foo ;
1688
1688
[ b = "S" ] = [ ] ;
1689
1689
console . log ( a + o . p + o . q + b ) ;
1690
1690
}
@@ -3886,3 +3886,54 @@ issue_5651: {
3886
3886
expect_stdout: true
3887
3887
node_version: ">=6"
3888
3888
}
3889
+
3890
+ issue_5843_1: {
3891
+ options = {
3892
+ unused : true ,
3893
+ }
3894
+ input: {
3895
+ var { p : a } = {
3896
+ __proto__ : {
3897
+ p : "PASS" ,
3898
+ } ,
3899
+ } ;
3900
+ console . log ( a ) ;
3901
+ }
3902
+ expect: {
3903
+ var a = {
3904
+ __proto__ : {
3905
+ p : "PASS" ,
3906
+ } ,
3907
+ } . p ;
3908
+ console . log ( a ) ;
3909
+ }
3910
+ expect_stdout: "PASS"
3911
+ node_version: ">=6"
3912
+ }
3913
+
3914
+ issue_5843_2: {
3915
+ options = {
3916
+ side_effects : true ,
3917
+ unused : true ,
3918
+ }
3919
+ input: {
3920
+ var a ;
3921
+ ( { p : a } = {
3922
+ __proto__ : {
3923
+ p : "PASS" ,
3924
+ } ,
3925
+ } ) ;
3926
+ console . log ( a ) ;
3927
+ }
3928
+ expect: {
3929
+ var a ;
3930
+ a = {
3931
+ __proto__ : {
3932
+ p : "PASS" ,
3933
+ } ,
3934
+ } . p ;
3935
+ console . log ( a ) ;
3936
+ }
3937
+ expect_stdout: "PASS"
3938
+ node_version: ">=6"
3939
+ }
Original file line number Diff line number Diff line change @@ -260,7 +260,7 @@ hoist_exports_2: {
260
260
}
261
261
}
262
262
expect: {
263
- let e , a = 42 [ " foo" ] ;
263
+ let e , a = 42. . foo ;
264
264
function f ( t , { [ e ] : o } ) {
265
265
t ( o , f ) ;
266
266
}
Original file line number Diff line number Diff line change @@ -1386,7 +1386,7 @@ issue_5076_1: {
1386
1386
expect: {
1387
1387
var a ;
1388
1388
console . log ( "PASS" ) ,
1389
- a = 42 [ "a" ] ;
1389
+ a = 42. . a ;
1390
1390
}
1391
1391
expect_stdout: "PASS"
1392
1392
node_version: ">=6"
You can’t perform that action at this time.
0 commit comments