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;
|
||||
}
|
||||
|
||||
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) {
|
||||
return !this.definition().undeclared
|
||||
|| compressor.option("unsafe") && global_names(this.name);
|
||||
|
|
|
|||
|
|
@ -243,12 +243,20 @@ issue_2233_1: {
|
|||
console.log;
|
||||
Date;
|
||||
Error.name;
|
||||
EvalError;
|
||||
Function.length;
|
||||
JSON;
|
||||
Math.random;
|
||||
Number.isNaN;
|
||||
parseInt;
|
||||
RegExp;
|
||||
Object.defineProperty;
|
||||
String.fromCharCode;
|
||||
RangeError;
|
||||
ReferenceError;
|
||||
SyntaxError;
|
||||
TypeError;
|
||||
URIError;
|
||||
}
|
||||
expect: {}
|
||||
expect_stdout: true
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user