@@ -141,6 +141,7 @@ var AST_Node = DEFNODE("Node", "start end", {
|
||||
}, null);
|
||||
|
||||
DEF_BITPROPS(AST_Node, [
|
||||
// AST_Node
|
||||
"_optimized",
|
||||
"_squeezed",
|
||||
// AST_Call
|
||||
@@ -175,6 +176,8 @@ DEF_BITPROPS(AST_Node, [
|
||||
"pure",
|
||||
// AST_Assign
|
||||
"redundant",
|
||||
// AST_Node
|
||||
"single_use",
|
||||
// AST_ClassProperty
|
||||
"static",
|
||||
// AST_Call
|
||||
|
||||
@@ -2080,7 +2080,7 @@ Compressor.prototype.compress = function(node) {
|
||||
return node;
|
||||
}
|
||||
// Skip transient nodes caused by single-use variable replacement
|
||||
if (node.single_use && parent instanceof AST_VarDef && parent.value === node) return node;
|
||||
if (node.single_use) return node;
|
||||
// Replace variable with assignment when found
|
||||
var hit_rhs;
|
||||
if (!(node instanceof AST_SymbolDeclaration)
|
||||
|
||||
@@ -9979,3 +9979,25 @@ issue_5396: {
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_5568: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
evaluate: true,
|
||||
reduce_vars: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
A = "FAIL";
|
||||
var a = (A = "PASS", !1);
|
||||
for (var b in a);
|
||||
console.log(A);
|
||||
}
|
||||
expect: {
|
||||
A = "FAIL";
|
||||
for (var b in !(A = "PASS"));
|
||||
console.log(A);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
@@ -460,6 +460,16 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
|
||||
return to_statement(node.definitions[0].value);
|
||||
}
|
||||
}
|
||||
else if (node instanceof U.AST_VarDef) {
|
||||
if (node.value) {
|
||||
node.start._permute++;
|
||||
CHANGED = true;
|
||||
return new U.AST_VarDef({
|
||||
name: node.name,
|
||||
start: {},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (in_list) {
|
||||
// drop switch branches
|
||||
|
||||
Reference in New Issue
Block a user