From: Mihai Bazon Date: Mon, 3 Sep 2012 16:43:46 +0000 (+0300) Subject: minor X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=e5f1cec6aa5998a681ad3c890a07d62d0cbb8d06;p=UglifyJS.git minor --- diff --git a/bin/uglifyjs2 b/bin/uglifyjs2 index 39a58e1d..258ca0e4 100755 --- a/bin/uglifyjs2 +++ b/bin/uglifyjs2 @@ -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") diff --git a/lib/compress.js b/lib/compress.js index 91a6c590..7e8ad3b8 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -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) }); }