disable `hoist_vars` by default and change `comparations` to `comparisons`
authorMihai Bazon <mihai@bazon.net>
Wed, 3 Oct 2012 08:27:05 +0000 (11:27 +0300)
committerMihai Bazon <mihai@bazon.net>
Wed, 3 Oct 2012 08:27:05 +0000 (11:27 +0300)
lib/compress.js
test/compress/conditionals.js

index d790a28..41578c1 100644 (file)
@@ -54,13 +54,13 @@ function Compressor(options, false_by_default) {
         drop_debugger : !false_by_default,
         unsafe        : !false_by_default,
         conditionals  : !false_by_default,
-        comparations  : !false_by_default,
+        comparisons   : !false_by_default,
         evaluate      : !false_by_default,
         booleans      : !false_by_default,
         loops         : !false_by_default,
         unused        : !false_by_default,
         hoist_funs    : !false_by_default,
-        hoist_vars    : !false_by_default,
+        hoist_vars    : false,
         if_return     : !false_by_default,
         join_vars     : !false_by_default,
         cascade       : !false_by_default,
@@ -632,7 +632,7 @@ merge(Compressor.prototype, {
         });
         def(AST_Binary, function(compressor){
             var self = this.clone(), op = this.operator;
-            if (compressor.option("comparations") && compressor.option("unsafe")) {
+            if (compressor.option("comparisons") && compressor.option("unsafe")) {
                 switch (op) {
                   case "<=" : self.operator = ">"  ; return self;
                   case "<"  : self.operator = ">=" ; return self;
@@ -1337,7 +1337,7 @@ merge(Compressor.prototype, {
     });
 
     OPT(AST_Binary, function(self, compressor){
-        if (compressor.option("comparations")) switch (self.operator) {
+        if (compressor.option("comparisons")) switch (self.operator) {
           case "===":
           case "!==":
             if ((self.left.is_string() && self.right.is_string()) ||
@@ -1415,7 +1415,7 @@ merge(Compressor.prototype, {
             if (best_of(exp[0], self) !== self)
                 return exp[0];
         }
-        if (compressor.option("comparations")) {
+        if (compressor.option("comparisons")) {
             if (!(compressor.parent() instanceof AST_Binary)) {
                 var negated = make_node(AST_UnaryPrefix, self, {
                     operator: "!",
index 8edc86e..bc4624d 100644 (file)
@@ -92,7 +92,7 @@ ifs_5: {
     options = {
         if_return: true,
         conditionals: true,
-        comparations: true,
+        comparisons: true,
     };
     input: {
         function f() {