aboutsummaryrefslogtreecommitdiff
path: root/test/compress/collapse_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-10-06 08:51:38 +0800
committerGitHub <noreply@github.com>2019-10-06 08:51:38 +0800
commit35338a100f62d881de06eebdaa1ed98c7212cfc4 (patch)
tree755621a77e6ba08c57b78d8671b13373518ee067 /test/compress/collapse_vars.js
parentd57b606e7387c103661538ee9df36dc18199b9ba (diff)
downloadtracifyjs-35338a100f62d881de06eebdaa1ed98c7212cfc4.tar.gz
tracifyjs-35338a100f62d881de06eebdaa1ed98c7212cfc4.zip
handle function/variable name collisions correctly (#3451)
fixes #3439
Diffstat (limited to 'test/compress/collapse_vars.js')
-rw-r--r--test/compress/collapse_vars.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 17835a89..090f3cf8 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -6197,3 +6197,43 @@ Infinity_assignment: {
}
expect_stdout: true
}
+
+issue_3439_1: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ console.log(typeof function(a) {
+ function a() {}
+ return a;
+ }(42));
+ }
+ expect: {
+ console.log(typeof function(a) {
+ function a() {}
+ return a;
+ }(42));
+ }
+ expect_stdout: "function"
+}
+
+issue_3439_2: {
+ options = {
+ collapse_vars: true,
+ unused: true,
+ }
+ input: {
+ console.log(typeof function() {
+ var a = 42;
+ function a() {}
+ return a;
+ }());
+ }
+ expect: {
+ console.log(typeof function() {
+ return 42;
+ }());
+ }
+ expect_stdout: "number"
+}