aboutsummaryrefslogtreecommitdiff
path: root/test/compress/collapse_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-10-20 03:53:20 +0800
committerGitHub <noreply@github.com>2019-10-20 03:53:20 +0800
commitca6dce43feb9d92cb5004c6ee4d5b2e0b4336d93 (patch)
tree993c51498c77a037410589184a907e765f72282f /test/compress/collapse_vars.js
parent543dd7d3d750e83b00e50bbf74fa786a7c1d243e (diff)
downloadtracifyjs-ca6dce43feb9d92cb5004c6ee4d5b2e0b4336d93.tar.gz
tracifyjs-ca6dce43feb9d92cb5004c6ee4d5b2e0b4336d93.zip
fix corner case in `collapse_vars` (#3501)
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r--test/compress/collapse_vars.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 2381333a..951d72d6 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -6237,3 +6237,24 @@ issue_3439_2: {
}
expect_stdout: "number"
}
+
+cond_sequence_return: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ console.log(function(n) {
+ var c = 0;
+ for (var k in [0, 1])
+ if (c++, k == n) return c;
+ }(1));
+ }
+ expect: {
+ console.log(function(n) {
+ var c = 0;
+ for (var k in [0, 1])
+ if (c++, k == n) return c;
+ }(1));
+ }
+ expect_stdout: "2"
+}