This commit is contained in:
Mihai Bazon
2012-09-03 19:43:46 +03:00
parent 37eecc16a4
commit e5f1cec6aa
2 changed files with 13 additions and 10 deletions

View File

@@ -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")

View 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)
});
}