aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-05-06 16:42:35 +0800
committerGitHub <noreply@github.com>2018-05-06 16:42:35 +0800
commit6b91d12ec352ad0494752aa6a74ee16cc99b5158 (patch)
treeecdfbec52c6c22a934464686abed68f1dbe8fa74 /test/compress
parentf37b91879f32b6ec9f99bc89350b3767119e3638 (diff)
downloadtracifyjs-6b91d12ec352ad0494752aa6a74ee16cc99b5158.tar.gz
tracifyjs-6b91d12ec352ad0494752aa6a74ee16cc99b5158.zip
fix corner case in `reduce_vars` (#3124)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/reduce_vars.js30
1 files changed, 29 insertions, 1 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index 14b6a46f..e47b96b5 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -5999,7 +5999,7 @@ issue_3113_5: {
]
}
-conditional_nested: {
+conditional_nested_1: {
options = {
evaluate: true,
reduce_vars: true,
@@ -6030,3 +6030,31 @@ conditional_nested: {
}
expect_stdout: "2"
}
+
+conditional_nested_2: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ }
+ input: {
+ var c = 0;
+ (function(a) {
+ function f() {
+ a && c++;
+ }
+ f(!c && f(), a = 1);
+ })();
+ console.log(c);
+ }
+ expect: {
+ var c = 0;
+ (function(a) {
+ function f() {
+ a && c++;
+ }
+ f(!c && f(), a = 1);
+ })();
+ console.log(c);
+ }
+ expect_stdout: "1"
+}