minor
authorMihai Bazon <mihai@bazon.net>
Mon, 3 Sep 2012 16:43:46 +0000 (19:43 +0300)
committerMihai Bazon <mihai@bazon.net>
Mon, 3 Sep 2012 20:25:30 +0000 (23:25 +0300)
bin/uglifyjs2
lib/compress.js

index 39a58e1..258ca0e 100755 (executable)
@@ -6,8 +6,9 @@ var sys = require("util");
 var optimist = require("optimist");
 var fs = require("fs");
 var ARGS = optimist
-    .usage("uglifyjs2 [options] input1.js input2.js ...\n\
-(maximum compression settings are on by default)\
+    .usage("uglifyjs2 [options] input1.js [input2.js ...]\n\
+Maximum compression settings are on by default.\n\
+Use a single dash to read input from the standard input.\
 ")
     .describe("source-map", "Specify an output file where to generate source map")
     .describe("source-map-root", "The root of the original source to be included in the source map")
index 91a6c59..7e8ad3b 100644 (file)
@@ -57,7 +57,6 @@ function Compressor(options, false_by_default) {
         sequences     : !false_by_default,
         properties    : !false_by_default,
         dead_code     : !false_by_default,
-        keep_comps    : !false_by_default,
         drop_debugger : !false_by_default,
         unsafe        : !false_by_default,
         conditionals  : !false_by_default,
@@ -309,6 +308,9 @@ function Compressor(options, false_by_default) {
                 return [ this ];
             }
         });
+        def(AST_Statement, function(){
+            throw new Error("Cannot evaluate a statement");
+        });
         function ev(node) {
             return node._eval();
         };
@@ -379,7 +381,7 @@ function Compressor(options, false_by_default) {
             return basic_negation(this);
         });
         def(AST_Statement, function(){
-            throw new Error("Cannot evaluate a statement");
+            throw new Error("Cannot negate a statement");
         });
         def(AST_UnaryPrefix, function(){
             if (this.operator == "!")
@@ -541,9 +543,9 @@ function Compressor(options, false_by_default) {
         if (!self.alternative && self.body instanceof AST_SimpleStatement) {
             return make_node(AST_SimpleStatement, self, {
                 body: make_node(AST_Binary, self, {
-                    operator: "&&",
-                    left: self.condition,
-                    right: self.body.body
+                    operator : "&&",
+                    left     : self.condition,
+                    right    : self.body.body
                 }).optimize(compressor)
             });
         }
@@ -552,9 +554,9 @@ function Compressor(options, false_by_default) {
             && !(self.alternative instanceof AST_EmptyStatement)) {
             return make_node(AST_SimpleStatement, self, {
                 body: make_node(AST_Binary, self, {
-                    operator: "||",
-                    left: self.condition,
-                    right: self.alternative.body
+                    operator : "||",
+                    left     : self.condition,
+                    right    : self.alternative.body
                 }).optimize(compressor)
             });
         }