@@ -4635,14 +4635,27 @@ merge(Compressor.prototype, {
|
|||||||
var lhs = node.left;
|
var lhs = node.left;
|
||||||
if (lhs instanceof AST_Destructured) {
|
if (lhs instanceof AST_Destructured) {
|
||||||
node.right.walk(tw);
|
node.right.walk(tw);
|
||||||
lhs.mark_symbol(function(node) {
|
var marker = new TreeWalker(function(node) {
|
||||||
if (node instanceof AST_SymbolRef) {
|
if (node instanceof AST_Destructured) return;
|
||||||
|
if (node instanceof AST_DestructuredKeyVal) {
|
||||||
|
if (node.key instanceof AST_Node) {
|
||||||
|
push();
|
||||||
|
node.key.walk(tw);
|
||||||
|
pop();
|
||||||
|
push();
|
||||||
|
node.value.walk(marker);
|
||||||
|
pop();
|
||||||
|
} else {
|
||||||
|
node.value.walk(marker);
|
||||||
|
}
|
||||||
|
} else if (node instanceof AST_SymbolRef) {
|
||||||
mark(node, false, true);
|
mark(node, false, true);
|
||||||
} else {
|
} else {
|
||||||
node.walk(tw);
|
node.walk(tw);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}, tw);
|
});
|
||||||
|
lhs.walk(marker);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (lhs instanceof AST_SymbolRef) {
|
if (lhs instanceof AST_SymbolRef) {
|
||||||
|
|||||||
@@ -1559,3 +1559,35 @@ issue_4298: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4301: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
try {
|
||||||
|
console.log(function() {
|
||||||
|
var a, b = console;
|
||||||
|
return {
|
||||||
|
[a = b]: a.p,
|
||||||
|
} = "foo";
|
||||||
|
}());
|
||||||
|
} catch (e) {
|
||||||
|
console.log("bar");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
try {
|
||||||
|
console.log(function() {
|
||||||
|
var a, b = console;
|
||||||
|
return {
|
||||||
|
[a = b]: a.p,
|
||||||
|
} = "foo";
|
||||||
|
}());
|
||||||
|
} catch (e) {
|
||||||
|
console.log("bar");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect_stdout: true
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user