Skip to content

Commit

Permalink
fix corner case in ie8 (#3543)
Browse files Browse the repository at this point in the history
fixes #3542
  • Loading branch information
alexlamsl committed Oct 28, 2019
1 parent f38e31b commit 83fb8b4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/compress.js
Expand Up @@ -4238,7 +4238,7 @@ merge(Compressor.prototype, {
def(AST_Binary, function(compressor, first_in_statement) {
var right = this.right.drop_side_effect_free(compressor, first_in_statement);
if (!right) return this.left.drop_side_effect_free(compressor, first_in_statement);
if (lazy_op[this.operator]) {
if (lazy_op[this.operator] && !(right instanceof AST_Function)) {
var node = this;
if (right !== node.right) {
node = this.clone();
Expand Down
22 changes: 22 additions & 0 deletions test/compress/ie8.js
Expand Up @@ -2339,3 +2339,25 @@ issue_3523_rename_ie8_toplevel: {
}
expect_stdout: "PASS"
}

issue_3542: {
options = {
ie8: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
var a = 0;
var b = a++;
var c = b && function a() {} || b;
console.log(a);
}
expect: {
var a = 0;
a++;
(function a() {});
console.log(a);
}
expect_stdout: "1"
}

0 comments on commit 83fb8b4

Please sign in to comment.