diff options
author | Mihai Bazon <mihai.bazon@gmail.com> | 2014-12-31 14:18:31 +0200 |
---|---|---|
committer | Mihai Bazon <mihai.bazon@gmail.com> | 2014-12-31 14:18:31 +0200 |
commit | 73cc0505f5d41fe4b24d5693e547de9478737187 (patch) | |
tree | 63f5e62bf51c269fb570e9287d36eb9cdc014d09 /lib/compress.js | |
parent | 5538ec7bd8a64c7fcc45895308a8463e4ca4d00a (diff) | |
parent | c75f5a1fd85368edb3456637c544dee0cad1011e (diff) | |
download | tracifyjs-73cc0505f5d41fe4b24d5693e547de9478737187.tar.gz tracifyjs-73cc0505f5d41fe4b24d5693e547de9478737187.zip |
Merge pull request #599 from rvanvelzen/fix-597
Fix #597
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js index e63ce148..f8030722 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -2203,14 +2203,30 @@ merge(Compressor.prototype, { case "undefined": return make_node(AST_Undefined, self); case "NaN": - return make_node(AST_NaN, self); + return make_node(AST_NaN, self).transform(compressor); case "Infinity": - return make_node(AST_Infinity, self); + return make_node(AST_Infinity, self).transform(compressor); } } return self; }); + OPT(AST_Infinity, function (self, compressor) { + return make_node(AST_Binary, self, { + operator : '/', + left : make_node(AST_Number, null, {value: 1}), + right : make_node(AST_Number, null, {value: 0}) + }); + }); + + OPT(AST_NaN, function (self, compressor) { + return make_node(AST_Binary, self, { + operator : '/', + left : make_node(AST_Number, null, {value: 0}), + right : make_node(AST_Number, null, {value: 0}) + }); + }); + OPT(AST_Undefined, function(self, compressor){ if (compressor.option("unsafe")) { var scope = compressor.find_parent(AST_Scope); |