aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-09-03 19:43:46 +0300
committerMihai Bazon <mihai@bazon.net>2012-09-03 23:25:30 +0300
commite5f1cec6aa5998a681ad3c890a07d62d0cbb8d06 (patch)
treef49d32d6d245b39e8e9325ee140714c7feb9d76e /lib/compress.js
parent37eecc16a419361672c0c055e0246ee7deb439b7 (diff)
downloadtracifyjs-e5f1cec6aa5998a681ad3c890a07d62d0cbb8d06.tar.gz
tracifyjs-e5f1cec6aa5998a681ad3c890a07d62d0cbb8d06.zip
minor
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js18
1 files changed, 10 insertions, 8 deletions
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)
});
}