@@ -2722,8 +2722,10 @@ Compressor.prototype.compress = function(node) {
|
||||
if (sym instanceof AST_PropAccess) return true;
|
||||
if (check_destructured(sym)) return true;
|
||||
return sym.match_symbol(function(node) {
|
||||
return node instanceof AST_SymbolRef
|
||||
&& (lvalues.has(node.name) || read_toplevel && compressor.exposed(node.definition()));
|
||||
if (node instanceof AST_PropAccess) return true;
|
||||
if (node instanceof AST_SymbolRef) {
|
||||
return lvalues.has(node.name) || read_toplevel && compressor.exposed(node.definition());
|
||||
}
|
||||
}, true);
|
||||
|
||||
function reject(node) {
|
||||
|
||||
@@ -3959,3 +3959,51 @@ issue_5844: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_5854_1: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
}
|
||||
input: {
|
||||
console.log(function(a) {
|
||||
var b = a;
|
||||
a++;
|
||||
[ b[0] ] = [ "foo" ];
|
||||
return a;
|
||||
}([]) ? "PASS" : "FAIL");
|
||||
}
|
||||
expect: {
|
||||
console.log(function(a) {
|
||||
var b = a;
|
||||
a++;
|
||||
[ b[0] ] = [ "foo" ];
|
||||
return a;
|
||||
}([]) ? "PASS" : "FAIL");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_5854_2: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
}
|
||||
input: {
|
||||
console.log(function(a) {
|
||||
var b = a;
|
||||
a++;
|
||||
({ p: b[0] } = { p: "foo" });
|
||||
return a;
|
||||
}([]) ? "PASS" : "FAIL");
|
||||
}
|
||||
expect: {
|
||||
console.log(function(a) {
|
||||
var b = a;
|
||||
a++;
|
||||
({ p: b[0] } = { p: "foo" });
|
||||
return a;
|
||||
}([]) ? "PASS" : "FAIL");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user