File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -1761,6 +1761,11 @@ Compressor.prototype.compress = function(node) {
1761
1761
1762
1762
var identifier_atom = makePredicate("Infinity NaN undefined");
1763
1763
function is_lhs_read_only(lhs, compressor) {
1764
+ if (lhs instanceof AST_Assign) {
1765
+ if (lhs.operator != "=") return true;
1766
+ if (lhs.right.tail_node().is_constant()) return true;
1767
+ return is_lhs_read_only(lhs.left, compressor);
1768
+ }
1764
1769
if (lhs instanceof AST_Atom) return true;
1765
1770
if (lhs instanceof AST_ObjectIdentity) return true;
1766
1771
if (lhs instanceof AST_PropAccess) {
Original file line number Diff line number Diff line change @@ -9864,7 +9864,8 @@ issue_5276: {
9864
9864
}
9865
9865
expect: {
9866
9866
var a = A = "PASS" ;
9867
- a . p = a . p + null - 42 ;
9867
+ a . p += null ;
9868
+ a . p -= 42 ;
9868
9869
console . log ( a ) ;
9869
9870
}
9870
9871
expect_stdout: "PASS"
@@ -10148,3 +10149,26 @@ issue_5719: {
10148
10149
}
10149
10150
expect_stdout: "PASS"
10150
10151
}
10152
+
10153
+ issue_5779: {
10154
+ options = {
10155
+ collapse_vars : true ,
10156
+ evaluate : true ,
10157
+ pure_getters : "strict" ,
10158
+ reduce_vars : true ,
10159
+ toplevel : true ,
10160
+ }
10161
+ input: {
10162
+ var a = A = "foo" ;
10163
+ a . p = 42 ;
10164
+ if ( a && ! a . p )
10165
+ console . log ( "PASS" ) ;
10166
+ }
10167
+ expect: {
10168
+ var a = A = "foo" ;
10169
+ a . p = 42 ;
10170
+ if ( a , ! a . p )
10171
+ console . log ( "PASS" ) ;
10172
+ }
10173
+ expect_stdout: "PASS"
10174
+ }
You can’t perform that action at this time.
0 commit comments