fix corner case in evaluate (#3559)

fixes #3558
This commit is contained in:
Alex Lam S.L
2019-11-01 00:01:25 +08:00
committed by GitHub
parent 3797458365
commit 1e9b576ee9
2 changed files with 25 additions and 4 deletions

View File

@@ -2862,10 +2862,10 @@ merge(Compressor.prototype, {
case "+": return +v;
case "++":
case "--":
if (e instanceof AST_SymbolRef) {
var refs = e.definition().references;
if (refs[refs.length - 1] === e) return v;
}
if (!(e instanceof AST_SymbolRef)) return this;
var refs = e.definition().references;
if (refs[refs.length - 1] !== e) return this;
return HOP(e, "_eval") ? +(this.operator[0] + 1) + +v : v;
}
return this;
});