aboutsummaryrefslogtreecommitdiff
path: root/test/compress/conditionals.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-01-01 00:09:26 +0800
committerGitHub <noreply@github.com>2018-01-01 00:09:26 +0800
commit673b0716379e261008b6cbf187e6b212104fb69e (patch)
tree5346618caed4b6e09e9f9131b7d1a359ab893fe0 /test/compress/conditionals.js
parentda82fa59a723b22ad5d8dec42cd2ca0d070f2359 (diff)
downloadtracifyjs-673b0716379e261008b6cbf187e6b212104fb69e.tar.gz
tracifyjs-673b0716379e261008b6cbf187e6b212104fb69e.zip
enhance `join_vars` & `sequences` (#2697)
- nudge declarations without assignments - within `AST_BlockStatement` - across `AST_If`
Diffstat (limited to 'test/compress/conditionals.js')
-rw-r--r--test/compress/conditionals.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/compress/conditionals.js b/test/compress/conditionals.js
index 4d61d39f..7838fdbb 100644
--- a/test/compress/conditionals.js
+++ b/test/compress/conditionals.js
@@ -1203,3 +1203,24 @@ issue_2560: {
"2",
]
}
+
+hoist_decl: {
+ options = {
+ conditionals: true,
+ join_vars: true,
+ sequences: true,
+ }
+ input: {
+ if (x()) {
+ var a;
+ y();
+ } else {
+ z();
+ var b;
+ }
+ }
+ expect: {
+ var a, b;
+ x() ? y() : z();
+ }
+}