aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-05-05 13:17:50 +0800
committerGitHub <noreply@github.com>2018-05-05 13:17:50 +0800
commitf37b91879f32b6ec9f99bc89350b3767119e3638 (patch)
tree0cdead7aed245de2292bfdb30d29601e1aae20a1 /test/compress/reduce_vars.js
parentd835c72c80c25307de90f73748055afb523352bb (diff)
downloadtracifyjs-f37b91879f32b6ec9f99bc89350b3767119e3638.tar.gz
tracifyjs-f37b91879f32b6ec9f99bc89350b3767119e3638.zip
fix various corner cases (#3123)
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 1d6d1896..14b6a46f 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -5998,3 +5998,35 @@ issue_3113_5: {
"1",
]
}
+
+conditional_nested: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ }
+ input: {
+ var a = 1, b = 0;
+ (function f(c) {
+ function g() {
+ c && (c.a = 0);
+ c && (c.a = 0);
+ c && (c[b++] *= 0);
+ }
+ g(a-- && f(g(c = 42)));
+ })();
+ console.log(b);
+ }
+ expect: {
+ var a = 1, b = 0;
+ (function f(c) {
+ function g() {
+ c && (c.a = 0);
+ c && (c.a = 0);
+ c && (c[b++] *= 0);
+ }
+ g(a-- && f(g(c = 42)));
+ })();
+ console.log(b);
+ }
+ expect_stdout: "2"
+}