add AST_Infinity node
authorMihai Bazon <mihai@bazon.net>
Tue, 9 Oct 2012 15:35:53 +0000 (18:35 +0300)
committerMihai Bazon <mihai@bazon.net>
Tue, 9 Oct 2012 15:35:53 +0000 (18:35 +0300)
lib/ast.js
lib/compress.js
lib/output.js

index 7324e69..afbd775 100644 (file)
@@ -845,6 +845,11 @@ var AST_Undefined = DEFNODE("Undefined", null, {
     value: (function(){}())
 }, AST_Atom);
 
+var AST_Infinity = DEFNODE("Infinity", null, {
+    $documentation: "The `Infinity` value",
+    value: 1/0
+}, AST_Atom);
+
 var AST_Boolean = DEFNODE("Boolean", null, {
     $documentation: "Base class for booleans",
 }, AST_Atom);
index 48a67d4..48f87e6 100644 (file)
@@ -1464,6 +1464,8 @@ merge(Compressor.prototype, {
                 return make_node(AST_Undefined, self);
               case "NaN":
                 return make_node(AST_NaN, self);
+              case "Infinity":
+                return make_node(AST_Infinity, self);
             }
         }
         return self;
index 571dd10..25b601e 100644 (file)
@@ -963,9 +963,10 @@ function OutputStream(options) {
         output.print_name(def ? def.mangled_name || def.name : self.name);
     });
     DEFPRINT(AST_Undefined, function(self, output){
-        // XXX: should add more options for this
         output.print("void 0");
-        //output.print("[][0]");
+    });
+    DEFPRINT(AST_Infinity, function(self, output){
+        output.print("1/0");
     });
     DEFPRINT(AST_NaN, function(self, output){
         output.print("0/0");