aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-03 01:33:09 +0800
committerGitHub <noreply@github.com>2018-02-03 01:33:09 +0800
commite773f0392769794173358b362a645facb51b2ad2 (patch)
tree119a78be61f37eb885caa5d65d01f1021a2d5569 /test
parentb16380d66961f408932de781a3425d2992ec51b3 (diff)
downloadtracifyjs-e773f0392769794173358b362a645facb51b2ad2.tar.gz
tracifyjs-e773f0392769794173358b362a645facb51b2ad2.zip
fix assignment logic in `reduce_vars` (#2872)
fixes #2869
Diffstat (limited to 'test')
-rw-r--r--test/compress/reduce_vars.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 761af9e2..c0148204 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -5507,3 +5507,29 @@ issue_2860_2: {
}
expect_stdout: "1"
}
+
+issue_2869: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ }
+ input: {
+ var c = "FAIL";
+ (function f(a) {
+ var a;
+ if (!f) a = 0;
+ if (a) c = "PASS";
+ })(1);
+ console.log(c);
+ }
+ expect: {
+ var c = "FAIL";
+ (function f(a) {
+ var a;
+ if (!f) a = 0;
+ if (a) c = "PASS";
+ })(1);
+ console.log(c);
+ }
+ expect_stdout: "PASS"
+}