File tree 2 files changed +50
-3
lines changed
2 files changed +50
-3
lines changed Original file line number Diff line number Diff line change @@ -13066,10 +13066,11 @@ Compressor.prototype.compress = function(node) {
13066
13066
|| !compressor.has_directive("use strict")
13067
13067
&& exp instanceof AST_Constant
13068
13068
&& !exp.may_throw_on_access(compressor)) {
13069
- return self.left instanceof AST_Dot ? self.right : make_sequence(self, [
13069
+ var value = self.left instanceof AST_Dot ? self.right : make_sequence(self, [
13070
13070
self.left.property,
13071
- self.right
13072
- ]).optimize(compressor);
13071
+ self.right,
13072
+ ]);
13073
+ return maintain_this_binding(compressor.parent(), self, value).optimize(compressor);
13073
13074
}
13074
13075
}
13075
13076
} else if (self.left instanceof AST_SymbolRef && can_drop_symbol(self.left, compressor)) {
Original file line number Diff line number Diff line change @@ -1730,3 +1730,49 @@ issue_5641: {
1730
1730
}
1731
1731
expect_stdout: "PASS"
1732
1732
}
1733
+
1734
+ issue_5882_1: {
1735
+ options = {
1736
+ dead_code : true ,
1737
+ pure_getters : "strict" ,
1738
+ }
1739
+ input: {
1740
+ console . log ( delete ( 42. . p = NaN ) ) ;
1741
+ }
1742
+ expect: {
1743
+ console . log ( delete ( 0 , NaN ) ) ;
1744
+ }
1745
+ expect_stdout: "true"
1746
+ }
1747
+
1748
+ issue_5882_2: {
1749
+ options = {
1750
+ dead_code : true ,
1751
+ pure_getters : "strict" ,
1752
+ sequences : true ,
1753
+ side_effects : true ,
1754
+ }
1755
+ input: {
1756
+ console . log ( delete ( 42. . p = NaN ) ) ;
1757
+ }
1758
+ expect: {
1759
+ console . log ( delete ( 0 , NaN ) ) ;
1760
+ }
1761
+ expect_stdout: "true"
1762
+ }
1763
+
1764
+ issue_5882_3: {
1765
+ options = {
1766
+ dead_code : true ,
1767
+ pure_getters : "strict" ,
1768
+ sequences : true ,
1769
+ side_effects : true ,
1770
+ }
1771
+ input: {
1772
+ console . log ( delete ( 42. . p = Infinity ) ) ;
1773
+ }
1774
+ expect: {
1775
+ console . log ( delete ( 1 / 0 ) ) ;
1776
+ }
1777
+ expect_stdout: "true"
1778
+ }
You can’t perform that action at this time.
0 commit comments