parent
ef74f2eaaf
commit
48e76eb98c
|
|
@ -482,6 +482,10 @@ merge(Compressor.prototype, {
|
||||||
def(AST_Arrow, mark_func_expr);
|
def(AST_Arrow, mark_func_expr);
|
||||||
def(AST_Assign, function(tw) {
|
def(AST_Assign, function(tw) {
|
||||||
var node = this;
|
var node = this;
|
||||||
|
if (node.left instanceof AST_Destructuring) {
|
||||||
|
node.left.walk(suppressor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (node.operator != "=" || !(node.left instanceof AST_SymbolRef)) return;
|
if (node.operator != "=" || !(node.left instanceof AST_SymbolRef)) return;
|
||||||
var d = node.left.definition();
|
var d = node.left.definition();
|
||||||
if (safe_to_assign(tw, d, node.right)
|
if (safe_to_assign(tw, d, node.right)
|
||||||
|
|
@ -705,7 +709,7 @@ merge(Compressor.prototype, {
|
||||||
var node = this;
|
var node = this;
|
||||||
if (node.name instanceof AST_Destructuring) {
|
if (node.name instanceof AST_Destructuring) {
|
||||||
node.name.walk(suppressor);
|
node.name.walk(suppressor);
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
var d = node.name.definition();
|
var d = node.name.definition();
|
||||||
if (d.fixed === undefined || safe_to_assign(tw, d, node.value)) {
|
if (d.fixed === undefined || safe_to_assign(tw, d, node.value)) {
|
||||||
|
|
|
||||||
|
|
@ -5446,3 +5446,22 @@ issue_2598: {
|
||||||
}
|
}
|
||||||
expect_stdout: "true"
|
expect_stdout: "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_2669: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
let foo;
|
||||||
|
console.log(([ foo ] = [ "PASS" ]) && foo);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
let foo;
|
||||||
|
console.log(([ foo ] = [ "PASS" ]) && foo);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user