aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/assignment.js36
-rw-r--r--test/compress/functions.js35
2 files changed, 71 insertions, 0 deletions
diff --git a/test/compress/assignment.js b/test/compress/assignment.js
index ece0185d..191b892e 100644
--- a/test/compress/assignment.js
+++ b/test/compress/assignment.js
@@ -311,3 +311,39 @@ issue_3375: {
}
expect_stdout: "string"
}
+
+issue_3402: {
+ options = {
+ assignments: true,
+ evaluate: true,
+ functions: true,
+ passes: 2,
+ 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: {
+ function f() {
+ console.log(typeof f);
+ }
+ f();
+ f();
+ console.log(typeof f);
+ }
+ expect_stdout: [
+ "function",
+ "function",
+ "function",
+ ]
+}
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",
+ ]
+}