diff --git a/lib/compress.js b/lib/compress.js index 7c60b763..45cc79e5 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -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); diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js index bee7994e..6ae368fa 100644 --- a/test/compress/dead-code.js +++ b/test/compress/dead-code.js @@ -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