tweaks for performance

This commit is contained in:
alexlamsl 2017-05-27 17:04:25 +08:00
parent 5e8bd62683
commit dac43d7a87

View File

@ -2251,12 +2251,12 @@ merge(Compressor.prototype, {
dirs.push(node); dirs.push(node);
return make_node(AST_EmptyStatement, node); return make_node(AST_EmptyStatement, node);
} }
if (node instanceof AST_Defun && hoist_funs if (hoist_funs && node instanceof AST_Defun
&& (tt.parent() === self || !compressor.has_directive("use strict"))) { && (tt.parent() === self || !compressor.has_directive("use strict"))) {
hoisted.push(node); hoisted.push(node);
return make_node(AST_EmptyStatement, node); return make_node(AST_EmptyStatement, node);
} }
if (node instanceof AST_Var && hoist_vars) { if (hoist_vars && node instanceof AST_Var) {
node.definitions.forEach(function(def){ node.definitions.forEach(function(def){
vars.set(def.name.name, def); vars.set(def.name.name, def);
++vars_found; ++vars_found;