enhance side_effects (#4124)

- add documentation for `merge_vars`
This commit is contained in:
Alex Lam S.L
2020-09-18 14:35:29 +01:00
committed by GitHub
parent 0f0759ec15
commit 38a46c86d7
3 changed files with 29 additions and 1 deletions

View File

@@ -3892,7 +3892,8 @@ merge(Compressor.prototype, {
if (is_undeclared_ref(expr) && global_pure_fns[expr.name]) return true;
if (expr instanceof AST_Dot && is_undeclared_ref(expr.expression)) {
var static_fn = static_fns[expr.expression.name];
return static_fn && static_fn[expr.property];
return static_fn && (static_fn[expr.property]
|| expr.expression.name == "Math" && expr.property == "random");
}
}
return this.pure || !compressor.pure_funcs(this);