fix corner case in evaluate (#3728)
- augment `ufuzz` for further `RegExp` testing
This commit is contained in:
@@ -315,7 +315,7 @@ merge(Compressor.prototype, {
|
||||
if (value instanceof AST_Array) return native_fns.Array[name];
|
||||
if (value instanceof AST_Function) return native_fns.Function[name];
|
||||
if (value instanceof AST_Object) return native_fns.Object[name];
|
||||
if (value instanceof AST_RegExp) return native_fns.RegExp[name];
|
||||
if (value instanceof AST_RegExp) return native_fns.RegExp[name] && !value.value.global;
|
||||
}
|
||||
|
||||
function is_modified(compressor, tw, node, value, level, immutable) {
|
||||
@@ -3003,6 +3003,7 @@ merge(Compressor.prototype, {
|
||||
].concat(object_fns),
|
||||
Object: object_fns,
|
||||
RegExp: [
|
||||
"exec",
|
||||
"test",
|
||||
].concat(object_fns),
|
||||
String: [
|
||||
@@ -3085,6 +3086,7 @@ merge(Compressor.prototype, {
|
||||
cached.forEach(function(node) {
|
||||
delete node._eval;
|
||||
});
|
||||
if (ignore_side_effects) return val;
|
||||
if (!val || val instanceof RegExp) return val;
|
||||
if (typeof val == "function" || typeof val == "object") return this;
|
||||
return val;
|
||||
@@ -3400,6 +3402,7 @@ merge(Compressor.prototype, {
|
||||
if (val == null || val === e) return this;
|
||||
var native_fn = native_fns[val.constructor.name];
|
||||
if (!native_fn || !native_fn[key]) return this;
|
||||
if (val instanceof RegExp && val.global && !(e instanceof AST_RegExp)) return this;
|
||||
}
|
||||
var args = eval_args(this.args);
|
||||
if (!args) return this;
|
||||
|
||||
Reference in New Issue
Block a user