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);
return true;
});
- PARENS(AST_NaN, function(output){
- var p = output.parent();
- if (p instanceof AST_PropAccess && p.expression === this)
- return true;
- });
-
PARENS([ AST_Assign, AST_Conditional ], function (output){
var p = output.parent();
// !(a = false) → true
});
DEFPRINT(AST_Hole, noop);
DEFPRINT(AST_Infinity, function(self, output){
- output.print("1/0");
+ output.print("Infinity");
});
DEFPRINT(AST_NaN, function(self, output){
- output.print("0/0");
+ output.print("NaN");
});
DEFPRINT(AST_This, function(self, output){
output.print("this");