fix corner cases with static modifier (#5599)

This commit is contained in:
Alex Lam S.L
2022-08-04 19:48:21 +01:00
committed by GitHub
parent 884842cd6c
commit 41b65af6e2
2 changed files with 91 additions and 3 deletions

View File

@@ -241,6 +241,94 @@ class_super: {
node_version: ">=4"
}
static_newline_1: {
input: {
class A {
static
P
}
console.log("P" in A, "static" in A);
console.log("P" in new A(), "static" in new A());
}
expect_exact: 'class A{static P}console.log("P"in A,"static"in A);console.log("P"in new A,"static"in new A);'
expect_stdout: [
"true false",
"false false",
]
node_version: ">=12"
}
static_newline_2: {
input: {
class A {
static
static
P
}
console.log("P" in A, "static" in A);
console.log("P" in new A(), "static" in new A());
}
expect_exact: 'class A{static static;P}console.log("P"in A,"static"in A);console.log("P"in new A,"static"in new A);'
expect_stdout: [
"false true",
"true false",
]
node_version: ">=12"
}
static_newline_3: {
input: {
class A {
static
static
static
P
}
console.log("P" in A, "static" in A);
console.log("P" in new A(), "static" in new A());
}
expect_exact: 'class A{static static;static P}console.log("P"in A,"static"in A);console.log("P"in new A,"static"in new A);'
expect_stdout: [
"true true",
"false false",
]
node_version: ">=12"
}
static_newline_4: {
input: {
class A {
static
static
static
static
P
}
console.log("P" in A, "static" in A);
console.log("P" in new A(), "static" in new A());
}
expect_exact: 'class A{static static;static static;P}console.log("P"in A,"static"in A);console.log("P"in new A,"static"in new A);'
expect_stdout: [
"false true",
"true false",
]
node_version: ">=12"
}
static_newline_init: {
input: {
class A {
static
{
console.log("PASS");
}
}
}
expect_exact: 'class A{static{console.log("PASS")}}'
expect_stdout: "PASS"
node_version: ">=16"
}
static_init: {
input: {
var a = "foo";