fix corner cases in inline (#3834)

fixes #3833
fixes #3835
This commit is contained in:
Alex Lam S.L
2020-05-01 02:06:40 +01:00
committed by GitHub
parent f80d5b8c9e
commit 74801de315
2 changed files with 54 additions and 0 deletions

View File

@@ -3991,10 +3991,17 @@ merge(Compressor.prototype, {
if (!call || call.TYPE != "Call") break;
var fn = call.expression;
if (fn instanceof AST_SymbolRef) {
if (self.name && self.name.definition() === fn.definition()) break;
fn = fn.fixed_value();
}
if (!(fn instanceof AST_Lambda)) break;
if (fn.uses_arguments) break;
if (fn === call.expression) {
if (fn.parent_scope !== self) break;
if (!all(fn.enclosed, function(def) {
return def.scope !== self;
})) break;
}
if (fn.contains_this()) break;
var j = fn.argnames.length;
if (j > 0 && compressor.option("inline") < 2) break;