collapse_vars: Do not consider RegExp literals to be constants

Fixes #1100
This commit is contained in:
kzc
2016-05-26 14:47:16 -04:00
parent 1e390269d4
commit 09d5707a8a
2 changed files with 57 additions and 1 deletions

View File

@@ -338,7 +338,7 @@ merge(Compressor.prototype, {
if (ref.scope.uses_eval || ref.scope.uses_with) break;
// Constant single use vars can be replaced in any scope.
if (var_decl.value.is_constant(compressor)) {
if (!(var_decl.value instanceof AST_RegExp) && var_decl.value.is_constant(compressor)) {
var ctt = new TreeTransformer(function(node) {
if (node === ref)
return replace_var(node, ctt.parent(), true);