Allow new.target in class properties (#759)
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "new.target can only be used in functions (1:4)"
|
||||
"throws": "new.target can only be used in functions (1:0)"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "new.target can only be used in functions (1:12)"
|
||||
"throws": "new.target can only be used in functions (1:8)"
|
||||
}
|
||||
|
||||
1
test/fixtures/experimental/class-properties/new-target-invalid/actual.js
vendored
Normal file
1
test/fixtures/experimental/class-properties/new-target-invalid/actual.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var x = new.target;
|
||||
4
test/fixtures/experimental/class-properties/new-target-invalid/options.json
vendored
Normal file
4
test/fixtures/experimental/class-properties/new-target-invalid/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": ["classProperties"],
|
||||
"throws": "new.target can only be used in functions or class properties (1:8)"
|
||||
}
|
||||
10
test/fixtures/experimental/class-properties/new-target-with-flow/actual.js
vendored
Normal file
10
test/fixtures/experimental/class-properties/new-target-with-flow/actual.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
class X {
|
||||
static a = new.target;
|
||||
static b = (foo = 1 + bar(new.target));
|
||||
static c = () => new.target;
|
||||
static d = (foo = new.target) => {};
|
||||
e = new.target;
|
||||
f = (foo = 1 + bar(new.target));
|
||||
g = () => new.target;
|
||||
h = (foo = new.target) => {};
|
||||
}
|
||||
1150
test/fixtures/experimental/class-properties/new-target-with-flow/expected.json
vendored
Normal file
1150
test/fixtures/experimental/class-properties/new-target-with-flow/expected.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
test/fixtures/experimental/class-properties/new-target-with-flow/options.json
vendored
Normal file
3
test/fixtures/experimental/class-properties/new-target-with-flow/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["classProperties", "flow"]
|
||||
}
|
||||
10
test/fixtures/experimental/class-properties/new-target/actual.js
vendored
Normal file
10
test/fixtures/experimental/class-properties/new-target/actual.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
class X {
|
||||
static a = new.target;
|
||||
static b = (foo = 1 + bar(new.target));
|
||||
static c = () => new.target;
|
||||
static d = (foo = new.target) => {};
|
||||
e = new.target;
|
||||
f = (foo = 1 + bar(new.target));
|
||||
g = () => new.target;
|
||||
h = (foo = new.target) => {};
|
||||
}
|
||||
1142
test/fixtures/experimental/class-properties/new-target/expected.json
vendored
Normal file
1142
test/fixtures/experimental/class-properties/new-target/expected.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
test/fixtures/experimental/class-properties/new-target/options.json
vendored
Normal file
3
test/fixtures/experimental/class-properties/new-target/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["classProperties"]
|
||||
}
|
||||
Reference in New Issue
Block a user