Fix #597 from UglifyJS
This commit is contained in:
parent
ff5f1ec141
commit
2a31e4a52c
|
|
@ -2235,14 +2235,30 @@ Cola.Compressor.MathFuncs = {
|
|||
case "undefined":
|
||||
return make_node(Cola.AST_Undefined, self);
|
||||
case "NaN":
|
||||
return make_node(Cola.AST_NaN, self);
|
||||
return make_node(Cola.AST_NaN, self).transform(compressor);
|
||||
case "Infinity":
|
||||
return make_node(Cola.AST_Infinity, self);
|
||||
return make_node(Cola.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(Cola.AST_Undefined, function(self, compressor){
|
||||
if (compressor.option("unsafe")) {
|
||||
var scope = compressor.find_parent(Cola.AST_Scope);
|
||||
|
|
|
|||
|
|
@ -522,12 +522,6 @@ Cola.OutputStream.prototype.parent = function(n) {
|
|||
return true;
|
||||
});
|
||||
|
||||
PARENS(Cola.AST_NaN, function(output){
|
||||
var p = output.parent();
|
||||
if (p instanceof Cola.AST_PropAccess && p.expression === this)
|
||||
return true;
|
||||
});
|
||||
|
||||
function assign_and_conditional_paren_rules(output) {
|
||||
var p = output.parent();
|
||||
// !(a = false) → true
|
||||
|
|
@ -1081,10 +1075,10 @@ Cola.OutputStream.prototype.parent = function(n) {
|
|||
});
|
||||
DEFPRINT(Cola.AST_Hole, Cola.noop);
|
||||
DEFPRINT(Cola.AST_Infinity, function(self, output){
|
||||
output.print("1/0");
|
||||
output.print("Infinity");
|
||||
});
|
||||
DEFPRINT(Cola.AST_NaN, function(self, output){
|
||||
output.print("0/0");
|
||||
output.print("NaN");
|
||||
});
|
||||
DEFPRINT(Cola.AST_This, function(self, output){
|
||||
output.print("this");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user