aboutsummaryrefslogtreecommitdiff
path: root/test/compress/collapse_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-11-17 05:24:02 +0800
committerGitHub <noreply@github.com>2019-11-17 05:24:02 +0800
commit10c1a78772c1d6ca1bc7f78f0fa1f2ab50b07ae2 (patch)
treebd5934e68527c31d35926c754b1173174dcb40eb /test/compress/collapse_vars.js
parenta6a0319f1c758013e8f1be9632fa30b031144835 (diff)
downloadtracifyjs-10c1a78772c1d6ca1bc7f78f0fa1f2ab50b07ae2.tar.gz
tracifyjs-10c1a78772c1d6ca1bc7f78f0fa1f2ab50b07ae2.zip
fix corner case in `collapse_vars` (#3591)
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r--test/compress/collapse_vars.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 2e82cc9d..6ad02b21 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -6238,7 +6238,7 @@ issue_3439_2: {
expect_stdout: "number"
}
-cond_sequence_return: {
+cond_sequence_return_1: {
options = {
collapse_vars: true,
}
@@ -6259,6 +6259,27 @@ cond_sequence_return: {
expect_stdout: "2"
}
+cond_sequence_return_2: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ console.log(function(n) {
+ var c = 0;
+ for (var k in [0, 1])
+ if (c += 1, k == n) return c;
+ }(1));
+ }
+ expect: {
+ console.log(function(n) {
+ var c = 0;
+ for (var k in [0, 1])
+ if (c += 1, k == n) return c;
+ }(1));
+ }
+ expect_stdout: "2"
+}
+
issue_3520: {
options = {
collapse_vars: true,