@@ -4906,20 +4906,39 @@ merge(Compressor.prototype, {
|
|||||||
var consequent = this.consequent.drop_side_effect_free(compressor);
|
var consequent = this.consequent.drop_side_effect_free(compressor);
|
||||||
var alternative = this.alternative.drop_side_effect_free(compressor);
|
var alternative = this.alternative.drop_side_effect_free(compressor);
|
||||||
if (consequent === this.consequent && alternative === this.alternative) return this;
|
if (consequent === this.consequent && alternative === this.alternative) return this;
|
||||||
if (!consequent) return alternative ? make_node(AST_Binary, this, {
|
var exprs;
|
||||||
operator: "||",
|
if (compressor.option("ie8")) {
|
||||||
left: this.condition,
|
exprs = [];
|
||||||
right: alternative
|
if (consequent instanceof AST_Function) {
|
||||||
}) : this.condition.drop_side_effect_free(compressor);
|
exprs.push(consequent);
|
||||||
if (!alternative) return make_node(AST_Binary, this, {
|
consequent = null;
|
||||||
operator: "&&",
|
}
|
||||||
left: this.condition,
|
if (alternative instanceof AST_Function) {
|
||||||
right: consequent
|
exprs.push(alternative);
|
||||||
});
|
alternative = null;
|
||||||
var node = this.clone();
|
}
|
||||||
node.consequent = consequent;
|
}
|
||||||
node.alternative = alternative;
|
var node;
|
||||||
return node;
|
if (!consequent) {
|
||||||
|
node = alternative ? make_node(AST_Binary, this, {
|
||||||
|
operator: "||",
|
||||||
|
left: this.condition,
|
||||||
|
right: alternative
|
||||||
|
}) : this.condition.drop_side_effect_free(compressor);
|
||||||
|
} else if (!alternative) {
|
||||||
|
node = make_node(AST_Binary, this, {
|
||||||
|
operator: "&&",
|
||||||
|
left: this.condition,
|
||||||
|
right: consequent
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
node = this.clone();
|
||||||
|
node.consequent = consequent;
|
||||||
|
node.alternative = alternative;
|
||||||
|
}
|
||||||
|
if (!compressor.option("ie8")) return node;
|
||||||
|
if (node) exprs.push(node);
|
||||||
|
return make_sequence(this, exprs);
|
||||||
});
|
});
|
||||||
def(AST_Constant, return_null);
|
def(AST_Constant, return_null);
|
||||||
def(AST_Dot, function(compressor, first_in_statement) {
|
def(AST_Dot, function(compressor, first_in_statement) {
|
||||||
|
|||||||
@@ -2420,3 +2420,28 @@ issue_3750: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3823: {
|
||||||
|
options = {
|
||||||
|
ie8: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
for (var i = 0; i < 1; i++) {
|
||||||
|
var a = a ? function f() {
|
||||||
|
f;
|
||||||
|
} : 0;
|
||||||
|
console.log("PASS", typeof f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
for (var i = 0; i < 1; i++) {
|
||||||
|
(function f() {
|
||||||
|
f;
|
||||||
|
});
|
||||||
|
console.log("PASS", typeof f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS undefined"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user