aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-04-10 06:51:03 +0800
committerGitHub <noreply@github.com>2018-04-10 06:51:03 +0800
commitb82fd0ad41983065ad6f58d9bfe4dac7720909bf (patch)
tree91c3cb2089fa2efbc6b1e38dd74d436058857e21 /test/compress
parent183da16896513c22b73d219affebeb155fb8ecdf (diff)
downloadtracifyjs-b82fd0ad41983065ad6f58d9bfe4dac7720909bf.tar.gz
tracifyjs-b82fd0ad41983065ad6f58d9bfe4dac7720909bf.zip
handle flow control in loops with `reduce_vars` (#3069)
fixes #3068
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/reduce_vars.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 59a99b9c..63a17e72 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -5654,3 +5654,59 @@ issue_3042_2: {
"true",
]
}
+
+issue_3068_1: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ }
+ input: {
+ (function() {
+ do {
+ continue;
+ var b = "defined";
+ } while (b && b.c);
+ })();
+ }
+ expect: {
+ (function() {
+ do {
+ continue;
+ var b = "defined";
+ } while (b && b.c);
+ })();
+ }
+ expect_stdout: true
+}
+
+issue_3068_2: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ }
+ input: {
+ (function() {
+ do {
+ try {
+ while ("" == typeof a);
+ } finally {
+ continue;
+ }
+ var b = "defined";
+ } while (b && b.c);
+ })();
+ }
+ expect: {
+ (function() {
+ do {
+ try {
+ while ("" == typeof a);
+ } finally {
+ continue;
+ }
+ var b = "defined";
+ } while (b && b.c);
+ })();
+ }
+ expect_stdout: true
+}