fix corner case in evaluate (#3729)

This commit is contained in:
Alex Lam S.L
2020-02-19 00:41:10 +00:00
committed by GitHub
parent 7052ce5aef
commit 6092bf23de
5 changed files with 59 additions and 7 deletions

View File

@@ -3416,6 +3416,8 @@ merge(Compressor.prototype, {
line: this.start.line,
col: this.start.col
});
} finally {
if (val instanceof RegExp) val.lastIndex = 0;
}
}
return this;
@@ -6866,7 +6868,7 @@ merge(Compressor.prototype, {
if (node.truthy) return true;
if (node.falsy) return false;
if (node.is_truthy()) return true;
return node.evaluate(compressor);
return node.evaluate(compressor, true);
}
function is_indexFn(node) {