add more known globals to unsafe option
This commit is contained in:
parent
5d9fb88856
commit
f7c6f60a47
|
|
@ -693,7 +693,7 @@ merge(Compressor.prototype, {
|
||||||
return node instanceof AST_SymbolRef && node.definition().undeclared;
|
return node instanceof AST_SymbolRef && node.definition().undeclared;
|
||||||
}
|
}
|
||||||
|
|
||||||
var global_names = makePredicate("Array Boolean console Date Error Function Math Number RegExp Object String");
|
var global_names = makePredicate("Array Boolean console Date Error EvalError Function JSON Math Number parseInt RangeError ReferenceError RegExp Object String SyntaxError TypeError URIError");
|
||||||
AST_SymbolRef.DEFMETHOD("is_declared", function(compressor) {
|
AST_SymbolRef.DEFMETHOD("is_declared", function(compressor) {
|
||||||
return !this.definition().undeclared
|
return !this.definition().undeclared
|
||||||
|| compressor.option("unsafe") && global_names(this.name);
|
|| compressor.option("unsafe") && global_names(this.name);
|
||||||
|
|
|
||||||
|
|
@ -243,12 +243,20 @@ issue_2233_1: {
|
||||||
console.log;
|
console.log;
|
||||||
Date;
|
Date;
|
||||||
Error.name;
|
Error.name;
|
||||||
|
EvalError;
|
||||||
Function.length;
|
Function.length;
|
||||||
|
JSON;
|
||||||
Math.random;
|
Math.random;
|
||||||
Number.isNaN;
|
Number.isNaN;
|
||||||
|
parseInt;
|
||||||
RegExp;
|
RegExp;
|
||||||
Object.defineProperty;
|
Object.defineProperty;
|
||||||
String.fromCharCode;
|
String.fromCharCode;
|
||||||
|
RangeError;
|
||||||
|
ReferenceError;
|
||||||
|
SyntaxError;
|
||||||
|
TypeError;
|
||||||
|
URIError;
|
||||||
}
|
}
|
||||||
expect: {}
|
expect: {}
|
||||||
expect_stdout: true
|
expect_stdout: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user