improve performance (#3020)

- replace `find_if()` with `all()` wherever possible
- move ESTree-specific logic out of `figure_out_scope()`
This commit is contained in:
Alex Lam S.L
2018-03-23 03:43:52 +08:00
committed by GitHub
parent d1c6bb8c7c
commit 49bfc6b555
5 changed files with 30 additions and 26 deletions

View File

@@ -3525,8 +3525,9 @@ merge(Compressor.prototype, {
var defs = [];
vars.each(function(def, name){
if (self instanceof AST_Lambda
&& find_if(function(x){ return x.name == def.name.name },
self.argnames)) {
&& !all(self.argnames, function(argname) {
return argname.name != name;
})) {
vars.del(name);
} else {
def = def.clone();