@@ -766,14 +766,14 @@ Compressor.prototype.compress = function(node) {
|
||||
function make_fixed_default(compressor, node, save) {
|
||||
var prev_save, prev_seq;
|
||||
return function() {
|
||||
if (prev_seq === node) return node;
|
||||
var current = save();
|
||||
var ev;
|
||||
if (!is_undefined(current, compressor) && (ev = fuzzy_eval(compressor, current, true)) !== undefined) {
|
||||
return ev instanceof AST_Node ? node : current;
|
||||
}
|
||||
if (prev_save !== current) {
|
||||
var ev = fuzzy_eval(compressor, current, true);
|
||||
if (ev instanceof AST_Node) {
|
||||
prev_seq = node;
|
||||
} else if (prev_save !== current) {
|
||||
prev_save = current;
|
||||
prev_seq = make_sequence(node, [ current, node.value ]);
|
||||
prev_seq = ev === undefined ? make_sequence(node, [ current, node.value ]) : current;
|
||||
}
|
||||
return prev_seq;
|
||||
};
|
||||
@@ -9152,6 +9152,7 @@ Compressor.prototype.compress = function(node) {
|
||||
|
||||
function fuzzy_eval(compressor, node, nullish) {
|
||||
if (node.truthy) return true;
|
||||
if (is_undefined(node)) return undefined;
|
||||
if (node.falsy && !nullish) return false;
|
||||
if (node.is_truthy()) return true;
|
||||
return node.evaluate(compressor, true);
|
||||
|
||||
@@ -2395,3 +2395,29 @@ issue_5448_4: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_5463: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
conditionals: true,
|
||||
evaluate: true,
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
unsafe: true,
|
||||
}
|
||||
input: {
|
||||
if (console.log("PASS"))
|
||||
var a = void 0,
|
||||
b = void 0,
|
||||
b = ([ a = FAIL ] = b && b);
|
||||
}
|
||||
expect: {
|
||||
var a, b, b;
|
||||
console.log("PASS") && (
|
||||
b = a = void 0,
|
||||
b = [a = FAIL] = a && a
|
||||
);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user