@@ -1598,8 +1598,7 @@ Compressor.prototype.compress = function(node) {
|
||||
AST_Destructured.DEFMETHOD("convert_symbol", convert_destructured);
|
||||
function convert_symbol(type, process) {
|
||||
var node = make_node(type, this, this);
|
||||
process(node, this);
|
||||
return node;
|
||||
return process(node, this) || node;
|
||||
}
|
||||
AST_SymbolDeclaration.DEFMETHOD("convert_symbol", convert_symbol);
|
||||
AST_SymbolRef.DEFMETHOD("convert_symbol", convert_symbol);
|
||||
@@ -10548,9 +10547,9 @@ Compressor.prototype.compress = function(node) {
|
||||
return try_evaluate(compressor, self);
|
||||
|
||||
function make_void_lhs(orig) {
|
||||
return make_node(AST_Dot, orig, {
|
||||
return make_node(AST_Sub, orig, {
|
||||
expression: make_node(AST_Array, orig, { elements: [] }),
|
||||
property: "e",
|
||||
property: make_node(AST_Number, orig, { value: 0 }),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10905,6 +10904,7 @@ Compressor.prototype.compress = function(node) {
|
||||
}));
|
||||
|
||||
function process(ref, name) {
|
||||
if (name.unused) return make_void_lhs(name);
|
||||
var def = name.definition();
|
||||
def.assignments++;
|
||||
def.references.push(ref);
|
||||
|
||||
@@ -541,7 +541,7 @@ inline_side_effects_2: {
|
||||
}
|
||||
expect: {
|
||||
var a = 42;
|
||||
[ [].e = --a ] = [ console ];
|
||||
[ [][0] = --a ] = [ console ];
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "42"
|
||||
@@ -1558,7 +1558,7 @@ issue_4502_4: {
|
||||
(function(a, b = console.log("FAIL")) {})(..."" + console.log(42));
|
||||
}
|
||||
expect: {
|
||||
[ , [].e = console.log("FAIL") ] = [ ..."" + console.log(42) ];
|
||||
[ , [][0] = console.log("FAIL") ] = [ ..."" + console.log(42) ];
|
||||
}
|
||||
expect_stdout: "42"
|
||||
node_version: ">=6"
|
||||
@@ -2183,7 +2183,7 @@ issue_5340_2: {
|
||||
}
|
||||
expect: {
|
||||
var a;
|
||||
[ [].e = 0 ] = [ ({ p: a } = true).q ];
|
||||
[ [][0] = 0 ] = [ ({ p: a } = true).q ];
|
||||
console.log(a);
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
@@ -2806,3 +2806,26 @@ issue_5533_4_drop_fargs: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_5536: {
|
||||
options = {
|
||||
inline: true,
|
||||
keep_fargs: true,
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
(function*() {
|
||||
(([], a = 42) => {})([]);
|
||||
console.log(typeof a);
|
||||
})().next();
|
||||
}
|
||||
expect: {
|
||||
(function*() {
|
||||
[ , [][0] = 0 ] = [ [] ],
|
||||
void 0;
|
||||
console.log(typeof a);
|
||||
})().next();
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
@@ -3497,7 +3497,7 @@ issue_5314_2: {
|
||||
A = this;
|
||||
new function() {
|
||||
[ {
|
||||
[console.log(this === A ? "FAIL" : "PASS")]: [].e,
|
||||
[console.log(this === A ? "FAIL" : "PASS")]: [][0],
|
||||
} ] = [ 42 ];
|
||||
}();
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ drop_new_function: {
|
||||
}
|
||||
expect: {
|
||||
void ([ ... {
|
||||
[console.log("PASS")]: [].e,
|
||||
[console.log("PASS")]: [][0],
|
||||
}] = []);
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
|
||||
@@ -907,7 +907,7 @@ drop_body: {
|
||||
})([ console.log("baz") ]);
|
||||
}
|
||||
expect: {
|
||||
[ [ , [].e = console.log("foo") ] ] = [ [ console.log("baz") ] ];
|
||||
[ [ , [][0] = console.log("foo") ] ] = [ [ console.log("baz") ] ];
|
||||
}
|
||||
expect_stdout: [
|
||||
"baz",
|
||||
|
||||
Reference in New Issue
Block a user