File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -3416,13 +3416,17 @@ Compressor.prototype.compress = function(node) {
3416
3416
if (def.references.length - def.replaced == referenced) return true;
3417
3417
if (!def.fixed) return false;
3418
3418
if (!lhs.fixed) return false;
3419
+ var assigns = lhs.fixed.assigns;
3419
3420
var matched = 0;
3420
3421
if (!all(def.references, function(ref, index) {
3421
3422
var fixed = ref.fixed;
3422
3423
if (!fixed) return false;
3423
3424
if (fixed.to_binary || fixed.to_prefix) return false;
3424
- if (fixed === lhs.fixed) matched++;
3425
- return true;
3425
+ if (fixed === lhs.fixed) {
3426
+ matched++;
3427
+ return true;
3428
+ }
3429
+ return assigns && fixed.assigns && assigns[0] !== fixed.assigns[0];
3426
3430
})) return false;
3427
3431
if (matched != referenced) return false;
3428
3432
verify_ref = true;
Original file line number Diff line number Diff line change @@ -10098,3 +10098,26 @@ issue_5638_4: {
10098
10098
}
10099
10099
expect_stdout: "foo 42"
10100
10100
}
10101
+
10102
+ issue_5643: {
10103
+ options = {
10104
+ collapse_vars : true ,
10105
+ reduce_vars : true ,
10106
+ toplevel : true ,
10107
+ }
10108
+ input: {
10109
+ var a = 3 , b ;
10110
+ a *= 7 ;
10111
+ b = ! ! this ;
10112
+ console || console . log ( b ) ;
10113
+ console . log ( a * ++ b ) ;
10114
+ }
10115
+ expect: {
10116
+ var a = 3 , b ;
10117
+ a *= 7 ;
10118
+ b = ! ! this ;
10119
+ console || console . log ( b ) ;
10120
+ console . log ( a * ++ b ) ;
10121
+ }
10122
+ expect_stdout: "42"
10123
+ }
You can’t perform that action at this time.
0 commit comments