fix corner case in evaluate (#4078)

fixes #4077
This commit is contained in:
Alex Lam S.L
2020-08-26 12:45:38 +01:00
committed by GitHub
parent 93d084a1d1
commit 3aa765e429
2 changed files with 16 additions and 1 deletions

View File

@@ -3502,7 +3502,8 @@ merge(Compressor.prototype, {
var left = this.left._eval(compressor, ignore_side_effects, cached, depth);
if (left === this.left) return this;
if (this.operator == (left ? "||" : "&&")) return left;
var right = this.right._eval(compressor, ignore_side_effects, cached, depth);
var rhs_ignore_side_effects = ignore_side_effects && !(left && typeof left == "object");
var right = this.right._eval(compressor, rhs_ignore_side_effects, cached, depth);
if (right === this.right) return this;
var result;
switch (this.operator) {