Add drop_error to new Error
Apply option to new Error also
This commit is contained in:
parent
43ff5ed37f
commit
6bf36b73ef
|
|
@ -2627,6 +2627,23 @@ merge(Compressor.prototype, {
|
|||
});
|
||||
|
||||
OPT(AST_New, function(self, compressor){
|
||||
|
||||
if (compressor.option("drop_error")) {
|
||||
var exp = self.expression;
|
||||
if (exp instanceof AST_SymbolRef
|
||||
&& (exp.name == "Error" ||
|
||||
exp.name == "EvalError" ||
|
||||
exp.name == "InternalError" ||
|
||||
exp.name == "RangeError" ||
|
||||
exp.name == "ReferenceError" ||
|
||||
exp.name == "SyntaxError" ||
|
||||
exp.name == "TypeError" ||
|
||||
exp.name == "URIError")
|
||||
&& exp.undeclared()) {
|
||||
// drop error description(s)
|
||||
self.args = [];
|
||||
}
|
||||
}
|
||||
if (compressor.option("unsafe")) {
|
||||
var exp = self.expression;
|
||||
if (exp instanceof AST_SymbolRef && exp.undeclared()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user