aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-10-20 07:02:39 +0100
committerGitHub <noreply@github.com>2020-10-20 14:02:39 +0800
commitfd8c0212b8d81b4f1630155bb170214ce87d0e70 (patch)
treeead89cf9675afc8f8a465fb73a389e520274cfa8 /test/compress
parent256950c2c0b4dc0c133fcc8aaf85f15579eb190f (diff)
downloadtracifyjs-fd8c0212b8d81b4f1630155bb170214ce87d0e70.tar.gz
tracifyjs-fd8c0212b8d81b4f1630155bb170214ce87d0e70.zip
fix corner case in `ie8` (#4232)
fixes #4231
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/const.js21
-rw-r--r--test/compress/let.js22
2 files changed, 42 insertions, 1 deletions
diff --git a/test/compress/const.js b/test/compress/const.js
index b20c4c59..694c9d16 100644
--- a/test/compress/const.js
+++ b/test/compress/const.js
@@ -438,7 +438,7 @@ catch_ie8_1: {
}
expect: {
try {} catch (a) {}
- console.log(function a() {
+ console.log(function() {
}());
}
expect_stdout: "undefined"
@@ -1065,3 +1065,22 @@ issue_4229: {
}
expect_stdout: true
}
+
+issue_4231: {
+ options = {
+ ie8: true,
+ side_effects: true,
+ }
+ input: {
+ typeof a == 0;
+ console.log(typeof function a() {
+ const a = 0;
+ });
+ }
+ expect: {
+ console.log(typeof function a() {
+ const a = 0;
+ });
+ }
+ expect_stdout: "function"
+}
diff --git a/test/compress/let.js b/test/compress/let.js
index c40ae9e3..8374db9a 100644
--- a/test/compress/let.js
+++ b/test/compress/let.js
@@ -871,3 +871,25 @@ issue_4229: {
expect_stdout: "PASS"
node_version: ">=4"
}
+
+issue_4231: {
+ options = {
+ ie8: true,
+ side_effects: true,
+ }
+ input: {
+ "use strict";
+ typeof a == 0;
+ console.log(typeof function a() {
+ let a;
+ });
+ }
+ expect: {
+ "use strict";
+ console.log(typeof function a() {
+ let a;
+ });
+ }
+ expect_stdout: "function"
+ node_version: ">=4"
+}