aboutsummaryrefslogtreecommitdiff
path: root/test/compress/functions.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-05-11 18:55:45 +0800
committerGitHub <noreply@github.com>2019-05-11 18:55:45 +0800
commit9fc8cd40763467d8b256be00380965268b7afcfd (patch)
treea96536e67f89b94a660e20b7bebabed39b0421e8 /test/compress/functions.js
parent5476cb8f05d0e7d402d583ef726e743451555c10 (diff)
downloadtracifyjs-9fc8cd40763467d8b256be00380965268b7afcfd.tar.gz
tracifyjs-9fc8cd40763467d8b256be00380965268b7afcfd.zip
fix corner case in `functions` (#3403)
fixes #3402
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r--test/compress/functions.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 21146457..82295383 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -3113,3 +3113,38 @@ issue_3400: {
"42",
]
}
+
+issue_3402: {
+ options = {
+ evaluate: true,
+ functions: true,
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ typeofs: true,
+ unused: true,
+ }
+ input: {
+ var f = function f() {
+ f = 42;
+ console.log(typeof f);
+ };
+ "function" == typeof f && f();
+ "function" == typeof f && f();
+ console.log(typeof f);
+ }
+ expect: {
+ var f = function f() {
+ f = 42;
+ console.log(typeof f);
+ };
+ f();
+ f();
+ console.log(typeof f);
+ }
+ expect_stdout: [
+ "function",
+ "function",
+ "function",
+ ]
+}