@@ -5188,6 +5188,12 @@ merge(Compressor.prototype, {
|
|||||||
fn.rest = null;
|
fn.rest = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OPT(AST_Lambda, function(self, compressor) {
|
||||||
|
drop_rest_farg(self, compressor);
|
||||||
|
self.body = tighten_body(self.body, compressor);
|
||||||
|
return self;
|
||||||
|
});
|
||||||
|
|
||||||
function opt_arrow(self, compressor) {
|
function opt_arrow(self, compressor) {
|
||||||
if (!compressor.option("arrows")) return self;
|
if (!compressor.option("arrows")) return self;
|
||||||
drop_rest_farg(self, compressor);
|
drop_rest_farg(self, compressor);
|
||||||
@@ -5210,12 +5216,6 @@ merge(Compressor.prototype, {
|
|||||||
OPT(AST_Arrow, opt_arrow);
|
OPT(AST_Arrow, opt_arrow);
|
||||||
OPT(AST_AsyncArrow, opt_arrow);
|
OPT(AST_AsyncArrow, opt_arrow);
|
||||||
|
|
||||||
OPT(AST_Defun, function(self, compressor) {
|
|
||||||
drop_rest_farg(self, compressor);
|
|
||||||
self.body = tighten_body(self.body, compressor);
|
|
||||||
return self;
|
|
||||||
});
|
|
||||||
|
|
||||||
OPT(AST_Function, function(self, compressor) {
|
OPT(AST_Function, function(self, compressor) {
|
||||||
drop_rest_farg(self, compressor);
|
drop_rest_farg(self, compressor);
|
||||||
self.body = tighten_body(self.body, compressor);
|
self.body = tighten_body(self.body, compressor);
|
||||||
@@ -10389,7 +10389,13 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
value = fixed.optimize(compressor);
|
if (fixed instanceof AST_Scope) {
|
||||||
|
compressor.push(fixed);
|
||||||
|
value = fixed.optimize(compressor);
|
||||||
|
compressor.pop();
|
||||||
|
} else {
|
||||||
|
value = fixed.optimize(compressor);
|
||||||
|
}
|
||||||
if (value === fixed) value = value.transform(new TreeTransformer(function(node, descend) {
|
if (value === fixed) value = value.transform(new TreeTransformer(function(node, descend) {
|
||||||
if (node instanceof AST_Scope) return node;
|
if (node instanceof AST_Scope) return node;
|
||||||
node = node.clone();
|
node = node.clone();
|
||||||
|
|||||||
@@ -1379,3 +1379,32 @@ issue_4738_3: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=8"
|
node_version: ">=8"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4747: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log(function(a) {
|
||||||
|
async function f() {
|
||||||
|
a = "PASS";
|
||||||
|
null.p += "PASS";
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
return a;
|
||||||
|
}("FAIL"));
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(function(a) {
|
||||||
|
(async function() {
|
||||||
|
a = "PASS";
|
||||||
|
null.p += "PASS";
|
||||||
|
})();
|
||||||
|
return a;
|
||||||
|
}("FAIL"));
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user