fix corner case with arguments (#4486)

fixes #4485
This commit is contained in:
Alex Lam S.L
2020-12-31 06:55:05 +00:00
committed by GitHub
parent 8b954b022b
commit 0b7d65d331
3 changed files with 176 additions and 1 deletions

View File

@@ -3344,7 +3344,9 @@ merge(Compressor.prototype, {
if (is_undeclared_ref(this) && this.is_declared(compressor)) return false;
if (this.is_immutable()) return false;
var def = this.definition();
if (is_arguments(def)) return def.scope.uses_arguments > 2;
if (is_arguments(def) && all(def.scope.argnames, function(argname) {
return argname instanceof AST_SymbolFunarg;
})) return def.scope.uses_arguments > 2;
var fixed = this.fixed_value();
if (!fixed) return true;
this._dot_throw = return_true;