aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-08-27 11:48:07 +0300
committerMihai Bazon <mihai@bazon.net>2012-08-27 11:48:07 +0300
commitbf70205b15ae11135c8e4e7bd99cecff28df73ba (patch)
treed1ddfb1a95b4b1f552988eed333a5b2006991eca
parent58a3b5e93f2b8390bc5e091c03ceb3feae5c4e39 (diff)
downloadtracifyjs-bf70205b15ae11135c8e4e7bd99cecff28df73ba.tar.gz
tracifyjs-bf70205b15ae11135c8e4e7bd99cecff28df73ba.zip
minor
-rwxr-xr-xtmp/test-node.js27
1 files changed, 20 insertions, 7 deletions
diff --git a/tmp/test-node.js b/tmp/test-node.js
index bb009e74..d737afde 100755
--- a/tmp/test-node.js
+++ b/tmp/test-node.js
@@ -11,29 +11,42 @@ var code = fs.readFileSync(filename, "utf8");
var ast = time_it("parse", function() {
return UglifyJS.parse(code);
});
-var stream = UglifyJS.OutputStream({ beautify: false });
+
time_it("scope", function(){
+ // calling figure_out_scope is a prerequisite for mangle_names,
+ // scope_warnings and compress
+ //
+ // perhaps figure_out_scope should be called automatically by the
+ // parser, but there might be instances where the functionality is
+ // not needed.
ast.figure_out_scope();
});
-// time_it("mangle", function(){
-// ast.mangle_names();
-// });
-//ast.scope_warnings();
+ast.scope_warnings();
+
+time_it("mangle", function(){
+ ast.mangle_names();
+});
time_it("compress", function(){
var compressor = new UglifyJS.Compressor({
+ // sequences : true,
+ // properties : true,
+ // dead_code : true,
+ // keep_comps : true,
+ // drop_debugger : true,
+ // unsafe : true,
+ // warnings : true
});
ast = ast.squeeze(compressor);
});
+var stream = UglifyJS.OutputStream({ beautify: false });
time_it("generate", function(){
ast.print(stream);
});
sys.puts(stream.get());
-//ast.scope_warnings();
-
function time_it(name, cont) {
var t1 = new Date().getTime();
try { return cont(); }