diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-09-18 10:53:46 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-09-18 10:53:46 +0300 |
commit | 21968285e8fad1cfe775b389c6bcd16e14b62c6c (patch) | |
tree | b1b26e0fc3f57e1ffee26d534552658b2404cf9a /lib/compress.js | |
parent | d91613b4a8318b7fdd0d18cf6550e6670c59f71e (diff) | |
download | tracifyjs-21968285e8fad1cfe775b389c6bcd16e14b62c6c.tar.gz tracifyjs-21968285e8fad1cfe775b389c6bcd16e14b62c6c.zip |
added AST_NaN (output as 0/0)
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/compress.js b/lib/compress.js index ca7bfe51..aedd78fd 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -526,9 +526,9 @@ function Compressor(options, false_by_default) { }); break; case "number": - ast = make_node(AST_Number, this, { + ast = make_node(isNaN(val) ? AST_NaN : AST_Number, this, { value: val - }); + }).optimize(compressor); break; case "boolean": ast = make_node(val ? AST_True : AST_False, this); @@ -1501,8 +1501,11 @@ function Compressor(options, false_by_default) { }); AST_SymbolRef.DEFMETHOD("optimize", function(compressor){ - if (this.name == "undefined" && this.undeclared()) { + if (this.undeclared()) switch (this.name) { + case "undefined": return make_node(AST_Undefined, this).optimize(compressor); + case "NaN": + return make_node(AST_NaN, this).optimize(compressor); } return this; }); |