aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-09-22 13:08:45 +0100
committerGitHub <noreply@github.com>2020-09-22 20:08:45 +0800
commit3472cf1a908f516d1f2dd69b773abc61d7019b44 (patch)
tree2b8dc719fb16781fcfcd798a7216e4bb0af5d098 /test
parent6d4c0fa6fabd7c5c75be419ed166b326f3da6bf3 (diff)
downloadtracifyjs-3472cf1a908f516d1f2dd69b773abc61d7019b44.tar.gz
tracifyjs-3472cf1a908f516d1f2dd69b773abc61d7019b44.zip
fix corner case in `unused` (#4147)
fixes #4146
Diffstat (limited to 'test')
-rw-r--r--test/compress/drop-unused.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 219adc9e..0b76f6f6 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -2965,3 +2965,30 @@ issue_4144: {
}
expect_stdout: "PASS"
}
+
+issue_4146: {
+ options = {
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function f(a, b) {
+ function g() {}
+ var a = g;
+ var c = b;
+ c.p;
+ console.log(typeof a);
+ }
+ f("FAIL", 42);
+ }
+ expect: {
+ (function(a, b) {
+ a = function () {};
+ var c = b;
+ c.p;
+ console.log(typeof a);
+ })(0, 42);
+ }
+ expect_stdout: "function"
+}