}
var passes = +this.options.passes || 1;
var last_count = 1 / 0;
+ var mangle = { ie8: this.option("ie8") };
for (var pass = 0; pass < passes; pass++) {
+ node.figure_out_scope(mangle);
if (pass > 0 || this.option("reduce_vars"))
node.reset_opt_flags(this);
node = node.transform(this);
&& !exp.uses_arguments
&& !exp.uses_eval
&& exp.body.length == 1
+ && !exp.contains_this()
&& all(exp.argnames, function(arg) {
return arg.__unused;
})
expression: stat.body
});
}
- if (value) {
- var tw = new TreeWalker(function(node) {
- if (!value) return true;
- if (node instanceof AST_SymbolRef) {
- var ref = node.scope.find_variable(node);
- if (ref && ref.scope.parent_scope === fn.parent_scope) {
- value = null;
- return true;
- }
- }
- if (node instanceof AST_This && !tw.find_parent(AST_Scope)) {
- value = null;
- return true;
- }
- });
- value.walk(tw);
- }
if (value) {
var args = self.args.concat(value);
return make_sequence(self, args).optimize(compressor);
if (options.wrap) {
toplevel = toplevel.wrap_commonjs(options.wrap);
}
- if (timings) timings.scope1 = Date.now();
- if (options.compress) toplevel.figure_out_scope(options.mangle);
if (timings) timings.compress = Date.now();
if (options.compress) toplevel = new Compressor(options.compress).compress(toplevel);
- if (timings) timings.scope2 = Date.now();
+ if (timings) timings.scope = Date.now();
if (options.mangle) toplevel.figure_out_scope(options.mangle);
if (timings) timings.mangle = Date.now();
if (options.mangle) {
if (timings) {
timings.end = Date.now();
result.timings = {
- parse: 1e-3 * (timings.scope1 - timings.parse),
- scope: 1e-3 * (timings.compress - timings.scope1 + timings.mangle - timings.scope2),
- compress: 1e-3 * (timings.scope2 - timings.compress),
+ parse: 1e-3 * (timings.compress - timings.parse),
+ compress: 1e-3 * (timings.scope - timings.compress),
+ scope: 1e-3 * (timings.mangle - timings.scope),
mangle: 1e-3 * (timings.properties - timings.mangle),
properties: 1e-3 * (timings.output - timings.properties),
output: 1e-3 * (timings.end - timings.output),