aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-31 06:55:05 +0000
committerGitHub <noreply@github.com>2020-12-31 14:55:05 +0800
commit0b7d65d33197e2cab4e57009c1bc5f6fd590b702 (patch)
treebac3e9e84f144bc1bd80ee1c81ae4c10bc595c20 /test
parent8b954b022bf206048f8380878251bd64795da5f9 (diff)
downloadtracifyjs-0b7d65d33197e2cab4e57009c1bc5f6fd590b702.tar.gz
tracifyjs-0b7d65d33197e2cab4e57009c1bc5f6fd590b702.zip
fix corner case with `arguments` (#4486)
fixes #4485
Diffstat (limited to 'test')
-rw-r--r--test/compress/default-values.js86
-rw-r--r--test/compress/destructured.js87
2 files changed, 173 insertions, 0 deletions
diff --git a/test/compress/default-values.js b/test/compress/default-values.js
index 5b21ae6a..ec7c10ff 100644
--- a/test/compress/default-values.js
+++ b/test/compress/default-values.js
@@ -1227,3 +1227,89 @@ issue_4483: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4485_1: {
+ options = {
+ pure_getters: "strict",
+ side_effects: true,
+ }
+ input: {
+ (function(a = null) {
+ var arguments;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })();
+ }
+ expect: {
+ (function(a = null) {
+ var arguments;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })();
+ }
+ expect_stdout: true
+ node_version: ">=6"
+}
+
+issue_4485_2: {
+ options = {
+ pure_getters: "strict",
+ side_effects: true,
+ }
+ input: {
+ (function(a = null) {
+ var arguments = null;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })();
+ }
+ expect: {
+ (function(a = null) {
+ var arguments = null;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })();
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+issue_4485_3: {
+ options = {
+ unused: true,
+ }
+ input: {
+ (function(a = null) {
+ var arguments;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })();
+ }
+ expect: {
+ (function(a = null) {
+ var arguments;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })();
+ }
+ expect_stdout: true
+ node_version: ">=6"
+}
diff --git a/test/compress/destructured.js b/test/compress/destructured.js
index ba7dbf3c..c506e8f0 100644
--- a/test/compress/destructured.js
+++ b/test/compress/destructured.js
@@ -2215,3 +2215,90 @@ issue_4456: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4485_1: {
+ options = {
+ pure_getters: "strict",
+ side_effects: true,
+ }
+ input: {
+ (function([]) {
+ var arguments;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })([]);
+ }
+ expect: {
+ (function([]) {
+ var arguments;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })([]);
+ }
+ expect_stdout: true
+ node_version: ">=6"
+}
+
+issue_4485_2: {
+ options = {
+ pure_getters: "strict",
+ side_effects: true,
+ }
+ input: {
+ (function([]) {
+ var arguments = null;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })([]);
+ }
+ expect: {
+ (function([]) {
+ var arguments = null;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })([]);
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}
+
+issue_4485_3: {
+ options = {
+ keep_fargs: false,
+ unused: true,
+ }
+ input: {
+ (function([]) {
+ var arguments;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })([]);
+ }
+ expect: {
+ (function([]) {
+ var arguments;
+ try {
+ arguments.length;
+ } catch (e) {
+ console.log("PASS");
+ }
+ })([]);
+ }
+ expect_stdout: true
+ node_version: ">=6"
+}