@@ -7211,6 +7211,9 @@ merge(Compressor.prototype, {
|
||||
if (!drop) break;
|
||||
var sym = elements[0];
|
||||
if (sym.has_side_effects(compressor)) break;
|
||||
if (value.has_side_effects(compressor) && sym.match_symbol(function(node) {
|
||||
return node instanceof AST_PropAccess;
|
||||
})) break;
|
||||
value = make_node(AST_Sub, node, {
|
||||
expression: value,
|
||||
property: make_node(AST_Number, node, { value: 0 }),
|
||||
@@ -7337,6 +7340,9 @@ merge(Compressor.prototype, {
|
||||
var prop = properties[0];
|
||||
if (prop.key instanceof AST_Node) break;
|
||||
if (prop.value.has_side_effects(compressor)) break;
|
||||
if (value.has_side_effects(compressor) && prop.value.match_symbol(function(node) {
|
||||
return node instanceof AST_PropAccess;
|
||||
})) break;
|
||||
value = make_node(AST_Sub, node, {
|
||||
expression: value,
|
||||
property: make_node_from_constant(prop.key, prop),
|
||||
|
||||
@@ -3322,3 +3322,47 @@ issue_5168: {
|
||||
expect_stdout: "function"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_5189_1: {
|
||||
options = {
|
||||
pure_getters: "strict",
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
var a = 42;
|
||||
[ a.p ] = a = "PASS";
|
||||
console.log(a);
|
||||
}
|
||||
expect: {
|
||||
var a;
|
||||
[ a.p ] = a = "PASS";
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_5189_2: {
|
||||
options = {
|
||||
pure_getters: "strict",
|
||||
reduce_vars: true,
|
||||
side_effects: true,
|
||||
toplevel: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
var a = 42;
|
||||
({ p: a.q } = a = "PASS");
|
||||
console.log(a);
|
||||
}
|
||||
expect: {
|
||||
var a;
|
||||
({ p: a.q } = a = "PASS");
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user