@@ -6830,8 +6830,8 @@ Compressor.prototype.compress = function(node) {
|
|||||||
unused_fn_names.push(node);
|
unused_fn_names.push(node);
|
||||||
}
|
}
|
||||||
if (!(node instanceof AST_Accessor)) {
|
if (!(node instanceof AST_Accessor)) {
|
||||||
var args, spread;
|
var args, spread, trim = compressor.drop_fargs(node, parent);
|
||||||
if (parent instanceof AST_Call && parent.expression === node) {
|
if (trim && parent instanceof AST_Call && parent.expression === node) {
|
||||||
args = parent.args;
|
args = parent.args;
|
||||||
for (spread = 0; spread < args.length; spread++) {
|
for (spread = 0; spread < args.length; spread++) {
|
||||||
if (args[spread] instanceof AST_Spread) break;
|
if (args[spread] instanceof AST_Spread) break;
|
||||||
@@ -6861,8 +6861,8 @@ Compressor.prototype.compress = function(node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
node.rest = rest;
|
node.rest = rest;
|
||||||
|
if (rest) trim = false;
|
||||||
}
|
}
|
||||||
var trim = compressor.drop_fargs(node, parent) && !node.rest;
|
|
||||||
var default_length = trim ? -1 : node.length();
|
var default_length = trim ? -1 : node.length();
|
||||||
for (var i = argnames.length; --i >= 0;) {
|
for (var i = argnames.length; --i >= 0;) {
|
||||||
var sym = argnames[i];
|
var sym = argnames[i];
|
||||||
|
|||||||
@@ -2007,6 +2007,7 @@ issue_5192: {
|
|||||||
|
|
||||||
issue_5246_1: {
|
issue_5246_1: {
|
||||||
options = {
|
options = {
|
||||||
|
keep_fargs: false,
|
||||||
pure_getters: true,
|
pure_getters: true,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
@@ -2016,20 +2017,20 @@ issue_5246_1: {
|
|||||||
}("foo"));
|
}("foo"));
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
console.log(function({} = 0) {
|
console.log(function() {
|
||||||
return "PASS";
|
return "PASS";
|
||||||
}("foo"));
|
}());
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
expect_warnings: [
|
expect_warnings: [
|
||||||
"INFO: Dropping unused default argument value {}=42 [test/compress/default-values.js:1,29]",
|
"INFO: Dropping unused default argument {}=42 [test/compress/default-values.js:1,29]",
|
||||||
"INFO: Dropping unused default argument value {}=0 [test/compress/default-values.js:1,29]",
|
|
||||||
]
|
]
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
issue_5246_2: {
|
issue_5246_2: {
|
||||||
options = {
|
options = {
|
||||||
|
keep_fargs: false,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
@@ -2038,9 +2039,9 @@ issue_5246_2: {
|
|||||||
})("PASS", []);
|
})("PASS", []);
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
(function(a = "FAIL", []) {
|
(function(a = "FAIL") {
|
||||||
console.log(a);
|
console.log(a);
|
||||||
})("PASS", []);
|
})("PASS");
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
@@ -2049,6 +2050,7 @@ issue_5246_2: {
|
|||||||
issue_5246_3: {
|
issue_5246_3: {
|
||||||
options = {
|
options = {
|
||||||
default_values: true,
|
default_values: true,
|
||||||
|
keep_fargs: false,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
@@ -2121,3 +2123,28 @@ issue_5314_2: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5336: {
|
||||||
|
options = {
|
||||||
|
default_values: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a;
|
||||||
|
do {
|
||||||
|
(function f(b = console.log("PASS")) {
|
||||||
|
a = f;
|
||||||
|
})(42);
|
||||||
|
} while (a());
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a;
|
||||||
|
do {
|
||||||
|
(function f(b = console.log("PASS")) {
|
||||||
|
a = f;
|
||||||
|
})(42);
|
||||||
|
} while (a());
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1130,7 +1130,7 @@ drop_unused_2: {
|
|||||||
}
|
}
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
expect:{
|
expect: {
|
||||||
(function(a) {
|
(function(a) {
|
||||||
console.log("PASS");
|
console.log("PASS");
|
||||||
})();
|
})();
|
||||||
@@ -3406,6 +3406,7 @@ issue_5288: {
|
|||||||
options = {
|
options = {
|
||||||
conditionals: true,
|
conditionals: true,
|
||||||
inline: true,
|
inline: true,
|
||||||
|
keep_fargs: false,
|
||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
toplevel: true,
|
toplevel: true,
|
||||||
unused: true,
|
unused: true,
|
||||||
@@ -3421,7 +3422,7 @@ issue_5288: {
|
|||||||
}() ]));
|
}() ]));
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
while ([ [ console ? console.log("PASS") : 0 ] ], void 0);
|
while (console ? console.log("PASS") : 0, void 0);
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ retain_funarg_destructured_object_1: {
|
|||||||
|
|
||||||
retain_funarg_destructured_object_2: {
|
retain_funarg_destructured_object_2: {
|
||||||
options = {
|
options = {
|
||||||
|
keep_fargs: false,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
@@ -1091,6 +1092,7 @@ issue_5100_2: {
|
|||||||
issue_5108: {
|
issue_5108: {
|
||||||
options = {
|
options = {
|
||||||
evaluate: true,
|
evaluate: true,
|
||||||
|
keep_fargs: false,
|
||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
rests: true,
|
rests: true,
|
||||||
unsafe: true,
|
unsafe: true,
|
||||||
@@ -1102,9 +1104,7 @@ issue_5108: {
|
|||||||
}([ "PASS", "FAIL" ]));
|
}([ "PASS", "FAIL" ]));
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
console.log(function([]) {
|
console.log("PASS");
|
||||||
return "PASS";
|
|
||||||
}([]));
|
|
||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
@@ -1208,6 +1208,7 @@ issue_5165_2: {
|
|||||||
|
|
||||||
issue_5246_1: {
|
issue_5246_1: {
|
||||||
options = {
|
options = {
|
||||||
|
keep_fargs: false,
|
||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
rests: true,
|
rests: true,
|
||||||
unused: true,
|
unused: true,
|
||||||
@@ -1218,9 +1219,9 @@ issue_5246_1: {
|
|||||||
}([ , function(){} ])[0]);
|
}([ , function(){} ])[0]);
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
console.log(typeof function([]) {
|
console.log(typeof function() {
|
||||||
return this && [ function(){} ];
|
return this && [ function(){} ];
|
||||||
}([])[0]);
|
}()[0]);
|
||||||
}
|
}
|
||||||
expect_stdout: "function"
|
expect_stdout: "function"
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
@@ -1228,6 +1229,7 @@ issue_5246_1: {
|
|||||||
|
|
||||||
issue_5246_2: {
|
issue_5246_2: {
|
||||||
options = {
|
options = {
|
||||||
|
keep_fargs: false,
|
||||||
reduce_vars: true,
|
reduce_vars: true,
|
||||||
rests: true,
|
rests: true,
|
||||||
toplevel: true,
|
toplevel: true,
|
||||||
@@ -1249,6 +1251,7 @@ issue_5246_2: {
|
|||||||
|
|
||||||
issue_5246_3: {
|
issue_5246_3: {
|
||||||
options = {
|
options = {
|
||||||
|
keep_fargs: false,
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
|
|||||||
@@ -1375,6 +1375,7 @@ issue_5076_1: {
|
|||||||
options = {
|
options = {
|
||||||
evaluate: true,
|
evaluate: true,
|
||||||
hoist_vars: true,
|
hoist_vars: true,
|
||||||
|
keep_fargs: false,
|
||||||
pure_getters: "strict",
|
pure_getters: "strict",
|
||||||
sequences: true,
|
sequences: true,
|
||||||
side_effects: true,
|
side_effects: true,
|
||||||
@@ -1404,6 +1405,7 @@ issue_5076_2: {
|
|||||||
options = {
|
options = {
|
||||||
evaluate: true,
|
evaluate: true,
|
||||||
hoist_vars: true,
|
hoist_vars: true,
|
||||||
|
keep_fargs: false,
|
||||||
passes: 2,
|
passes: 2,
|
||||||
pure_getters: "strict",
|
pure_getters: "strict",
|
||||||
sequences: true,
|
sequences: true,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ describe("async", function() {
|
|||||||
"function await() {}",
|
"function await() {}",
|
||||||
"function(await) {}",
|
"function(await) {}",
|
||||||
"function() { await; }",
|
"function() { await; }",
|
||||||
"function() { await:{} }",
|
"function() { await: {} }",
|
||||||
"function() { var await; }",
|
"function() { var await; }",
|
||||||
"function() { function await() {} }",
|
"function() { function await() {} }",
|
||||||
"function() { try {} catch (await) {} }",
|
"function() { try {} catch (await) {} }",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ describe("generator", function() {
|
|||||||
[
|
[
|
||||||
"function yield() {}",
|
"function yield() {}",
|
||||||
"function(yield) {}",
|
"function(yield) {}",
|
||||||
"function() { yield:{} }",
|
"function() { yield: {} }",
|
||||||
"function() { var yield; }",
|
"function() { var yield; }",
|
||||||
"function() { function yield() {} }",
|
"function() { function yield() {} }",
|
||||||
"function() { try {} catch (yield) {} }",
|
"function() { try {} catch (yield) {} }",
|
||||||
|
|||||||
Reference in New Issue
Block a user