x = 10;
throw "foo";
// completely discarding the `if` would introduce some
- // bugs. UglifyJS v1 doesn't deal with this issue.
+ // bugs. UglifyJS v1 doesn't deal with this issue; in v2
+ // we copy any declarations to the upper scope.
if (x) {
y();
var x;
function g(){};
+ // but nested declarations should not be kept.
+ (function(){
+ var q;
+ function y(){};
+ })();
}
}
}
}
function log_directory(dir) {
- log("--- Entering [{dir}]", { dir: dir });
+ log("*** Entering [{dir}]", { dir: dir });
}
function log_start_file(file) {
- log("*** {file}", { file: file });
+ log("--- {file}", { file: file });
}
function log_test(name) {
var ast = time_it("parse", function() {
return UglifyJS.parse(code);
});
-var stream = UglifyJS.OutputStream({ beautify: true });
+var stream = UglifyJS.OutputStream({ beautify: false });
time_it("scope", function(){
ast.figure_out_scope();
});
-time_it("mangle", function(){
- ast.mangle_names();
-});
+// time_it("mangle", function(){
+// ast.mangle_names();
+// });
-ast.scope_warnings();
+//ast.scope_warnings();
time_it("compress", function(){
var compressor = new UglifyJS.Compressor({
});
ast = ast.squeeze(compressor);
});
+
time_it("generate", function(){
ast.print(stream);
});
sys.puts(stream.get());
-ast.scope_warnings();
+//ast.scope_warnings();
function time_it(name, cont) {
var t1 = new Date().getTime();