From 1e9b576ee9938d6acb9dff277474e9a32f866690 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 1 Nov 2019 00:01:25 +0800 Subject: fix corner case in `evaluate` (#3559) fixes #3558 --- lib/compress.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/compress.js b/lib/compress.js index a6f5d20b..65768c02 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -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; }); -- cgit v1.2.3