aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-01 00:01:25 +0800
committerGitHub <noreply@github.com>2019-11-01 00:01:25 +0800
commit1e9b576ee9938d6acb9dff277474e9a32f866690 (patch)
tree349242595768256e7f29fa6a2e8dec01556e2880 /lib
parent379745836510c23ac980a3c28f6754181aba12b9 (diff)
downloadtracifyjs-1e9b576ee9938d6acb9dff277474e9a32f866690.tar.gz
tracifyjs-1e9b576ee9938d6acb9dff277474e9a32f866690.zip
fix corner case in `evaluate` (#3559)
fixes #3558
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js8
1 files changed, 4 insertions, 4 deletions
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;
});