aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-01-07 07:05:48 +0000
committerGitHub <noreply@github.com>2021-01-07 15:05:48 +0800
commitcf1b0165af4a181e8af6365eddbb144ce0d45da3 (patch)
tree6c3a8613990feef0f84e68bfa42216f734bedc3f /test
parentc3d358a5b8e00c51ba7a2e9d8c25b7771f5f5a46 (diff)
downloadtracifyjs-cf1b0165af4a181e8af6365eddbb144ce0d45da3.tar.gz
tracifyjs-cf1b0165af4a181e8af6365eddbb144ce0d45da3.zip
fix corner case in `hoist_vars` (#4518)
fixes #4517
Diffstat (limited to 'test')
-rw-r--r--test/compress/hoist_vars.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/compress/hoist_vars.js b/test/compress/hoist_vars.js
index 82f8ede6..020155aa 100644
--- a/test/compress/hoist_vars.js
+++ b/test/compress/hoist_vars.js
@@ -172,8 +172,38 @@ issue_4489: {
A = 0;
var o = !0 || null;
for (var k in o);
+ console.log(k);
}
expect: {
- for (var k in !(A = 0));
+ !(A = 0);
+ for (var k in true);
+ console.log(k);
}
+ expect_stdout: "undefined"
+}
+
+issue_4517: {
+ options = {
+ collapse_vars: true,
+ hoist_vars: true,
+ join_vars: true,
+ reduce_vars: true,
+ unused: true,
+ }
+ input: {
+ console.log(function() {
+ var a = 2;
+ A = a;
+ var b = typeof !1;
+ return A + b;
+ }());
+ }
+ expect: {
+ console.log(function() {
+ var a = 2;
+ A = a;
+ return A + typeof !1;
+ }());
+ }
+ expect_stdout: "2boolean"
}