diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-10-09 18:35:53 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-10-09 18:35:53 +0300 |
commit | a84d07e31298fc1f8825b0047629634920667707 (patch) | |
tree | 44f924b4e5625900a2fdaf279401789b7a8b1be4 | |
parent | 88beddfa91c8f362cc74538937ce883541e77680 (diff) | |
download | tracifyjs-a84d07e31298fc1f8825b0047629634920667707.tar.gz tracifyjs-a84d07e31298fc1f8825b0047629634920667707.zip |
add AST_Infinity node
-rw-r--r-- | lib/ast.js | 5 | ||||
-rw-r--r-- | lib/compress.js | 2 | ||||
-rw-r--r-- | lib/output.js | 5 |
3 files changed, 10 insertions, 2 deletions
@@ -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); diff --git a/lib/compress.js b/lib/compress.js index 48a67d41..48f87e6a 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -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; diff --git a/lib/output.js b/lib/output.js index 571dd106..25b601ef 100644 --- a/lib/output.js +++ b/lib/output.js @@ -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"); |