aboutsummaryrefslogtreecommitdiff
path: root/test/compress/functions.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-16 12:58:51 +0000
committerGitHub <noreply@github.com>2021-03-16 20:58:51 +0800
commit9a9543013c9d56cfc9593893fb9bfdff2aaa0307 (patch)
tree51c9711bb30e47ae6582b1209222a43cb9fe31d5 /test/compress/functions.js
parentb98ce6c84fcd7cc5203aa0657b216e52103ca9e4 (diff)
downloadtracifyjs-9a9543013c9d56cfc9593893fb9bfdff2aaa0307.tar.gz
tracifyjs-9a9543013c9d56cfc9593893fb9bfdff2aaa0307.zip
fix corner case in `functions` (#4789)
fixes #4788
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r--test/compress/functions.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 68ff709b..e43efcea 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -5912,3 +5912,40 @@ issue_4753_2: {
}
expect_stdout: "PASS"
}
+
+issue_4788: {
+ options = {
+ evaluate: true,
+ functions: true,
+ keep_fnames: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function f() {
+ var a = function g() {
+ if (0) {
+ var g = 42;
+ f();
+ }
+ g || console.log("PASS");
+ };
+ a(a);
+ }
+ f();
+ }
+ expect: {
+ (function f() {
+ function a() {
+ if (0) {
+ var g = 42;
+ f();
+ }
+ g || console.log("PASS");
+ }
+ a();
+ })();
+ }
+ expect_stdout: "PASS"
+}