replace keep_fargs default to false (#4443)

This commit is contained in:
Alex Lam S.L
2020-12-24 01:56:02 +00:00
committed by GitHub
parent 2390fae5c4
commit 6988cd9558
24 changed files with 219 additions and 263 deletions

View File

@@ -71,7 +71,7 @@ function Compressor(options, false_by_default) {
if_return : !false_by_default,
inline : !false_by_default,
join_vars : !false_by_default,
keep_fargs : false_by_default || "strict",
keep_fargs : false_by_default,
keep_fnames : false,
keep_infinity : false,
loops : !false_by_default,
@@ -113,8 +113,7 @@ function Compressor(options, false_by_default) {
}
}
if (this.options["inline"] === true) this.options["inline"] = 3;
var keep_fargs = this.options["keep_fargs"];
this.drop_fargs = keep_fargs == "strict" ? function(lambda, parent) {
this.drop_fargs = this.options["keep_fargs"] ? return_false : function(lambda, parent) {
if (lambda.length_read) return false;
var name = lambda.name;
if (!name) return parent && parent.TYPE == "Call" && parent.expression === lambda;
@@ -123,7 +122,7 @@ function Compressor(options, false_by_default) {
if (def.direct_access) return false;
var escaped = def.escaped;
return escaped && escaped.depth != 1;
} : keep_fargs ? return_false : return_true;
};
var pure_funcs = this.options["pure_funcs"];
if (typeof pure_funcs == "function") {
this.pure_funcs = pure_funcs;