aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-07-26 02:27:54 +0100
committerGitHub <noreply@github.com>2020-07-26 09:27:54 +0800
commit6d3dcaa59e5b7a6e3bef2de1daf4edd66a7bf274 (patch)
treeedf8d6e276046829aa755d86312f1e2399e8977b /test
parent1bc0df1569c08618cf9c14e6e7a22dc89f25eb86 (diff)
downloadtracifyjs-6d3dcaa59e5b7a6e3bef2de1daf4edd66a7bf274.tar.gz
tracifyjs-6d3dcaa59e5b7a6e3bef2de1daf4edd66a7bf274.zip
fix corner case in `unused` (#4026)
fixes #4025
Diffstat (limited to 'test')
-rw-r--r--test/compress/drop-unused.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index ee06199d..6ab4fe3b 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -2813,3 +2813,38 @@ issue_4017: {
}
expect_stdout: "undefined"
}
+
+issue_4025: {
+ options = {
+ collapse_vars: true,
+ evaluate: true,
+ passes: 2,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var a = 0, b = 0, c = 0, d = a++;
+ try {
+ var e = console.log(c), f = b;
+ } finally {
+ var d = b = 1, d = c + 1;
+ c = 0;
+ }
+ console.log(a, b, d);
+ }
+ expect: {
+ var d, c = 0;
+ try {
+ console.log(c);
+ } finally {
+ d = c + 1;
+ c = 0;
+ }
+ console.log(1, 1, d);
+ }
+ expect_stdout: [
+ "0",
+ "1 1 1",
+ ]
+}