Fixing exception when evaluate regualr exceptions.
This commit is contained in:
parent
b9fea8e7e9
commit
1bc9ddea7e
|
|
@ -168,7 +168,9 @@ merge(Compressor.prototype, {
|
||||||
return make_node(AST_Null, orig).optimize(compressor);
|
return make_node(AST_Null, orig).optimize(compressor);
|
||||||
}
|
}
|
||||||
if (val instanceof RegExp) {
|
if (val instanceof RegExp) {
|
||||||
return make_node(AST_RegExp, orig).optimize(compressor);
|
return make_node(AST_RegExp, orig, {
|
||||||
|
value: val
|
||||||
|
}).optimize(compressor);
|
||||||
}
|
}
|
||||||
throw new Error(string_template("Can't handle constant of type: {type}", {
|
throw new Error(string_template("Can't handle constant of type: {type}", {
|
||||||
type: typeof val
|
type: typeof val
|
||||||
|
|
@ -909,7 +911,11 @@ merge(Compressor.prototype, {
|
||||||
var value = def.value.evaluate(compressor, true);
|
var value = def.value.evaluate(compressor, true);
|
||||||
def.value = value[0];
|
def.value = value[0];
|
||||||
if (value.length > 1) {
|
if (value.length > 1) {
|
||||||
if (!(typeof value[1] === 'string' && value[1].length >= inlineStringThreshold))
|
if (typeof value[1] === 'string' && value[1].length < inlineStringThreshold
|
||||||
|
|| typeof value[1] === 'number'
|
||||||
|
|| typeof value[1] === 'boolean'
|
||||||
|
|| value[1] === null
|
||||||
|
)
|
||||||
definitions[def.name.name] = value[1];
|
definitions[def.name.name] = value[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user