aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-03-06 23:11:36 +0000
committerGitHub <noreply@github.com>2021-03-07 07:11:36 +0800
commitc7520b4b971c0afcfb66a9ffa215d0d8e4a6fabe (patch)
treea80fef13044751527724eab0c0d0bfc9d99187f3 /test
parentad903e924050067a96a33f2eb5a0b9ab3e5454c1 (diff)
downloadtracifyjs-c7520b4b971c0afcfb66a9ffa215d0d8e4a6fabe.tar.gz
tracifyjs-c7520b4b971c0afcfb66a9ffa215d0d8e4a6fabe.zip
support `new.target` (#4746)
fixes #4745
Diffstat (limited to 'test')
-rw-r--r--test/compress/classes.js19
-rw-r--r--test/compress/functions.js19
2 files changed, 38 insertions, 0 deletions
diff --git a/test/compress/classes.js b/test/compress/classes.js
index 93819bfa..a1b4f0cd 100644
--- a/test/compress/classes.js
+++ b/test/compress/classes.js
@@ -1225,3 +1225,22 @@ issue_4725_2: {
expect_stdout: "PASS"
node_version: ">=4"
}
+
+new_target: {
+ input: {
+ console.log(typeof new class {
+ constructor() {
+ this.f = () => new.target;
+ }
+ }().f());
+ }
+ expect: {
+ console.log(typeof new class {
+ constructor() {
+ this.f = () => new.target;
+ }
+ }().f());
+ }
+ expect_stdout: "function"
+ node_version: ">=6"
+}
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 30779c15..856dbcea 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -5752,3 +5752,22 @@ issue_4725_2: {
expect_stdout: "PASS"
node_version: ">=4"
}
+
+new_target: {
+ input: {
+ console.log(typeof new function() {
+ return new.target;
+ }, function() {
+ return new.target;
+ }());
+ }
+ expect: {
+ console.log(typeof new function() {
+ return new.target;
+ }(), function() {
+ return new.target;
+ }());
+ }
+ expect_stdout: "function undefined"
+ node_version: ">=6"
+}