Enable class static blocks by default (#13713)

* Remove classStaticBlock plugin

* Update tests

* Remove class static blocks from proposalPlugins

* Update tests

* Remove classStaticBlock from mapping for test262

* chore: update babel-types

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
This commit is contained in:
Sosuke Suzuki
2021-10-29 03:39:04 +09:00
committed by GitHub
parent 99a3fefede
commit ddc45a5a50
181 changed files with 179 additions and 114 deletions

View File

@@ -1619,7 +1619,6 @@ export default class StatementParser extends ExpressionParser {
classBody: N.ClassBody,
member: N.StaticBlock & { decorators?: Array<N.Decorator> },
) {
this.expectPlugin("classStaticBlock", member.start);
// Start a new lexical scope
this.scope.enter(SCOPE_CLASS | SCOPE_STATIC_BLOCK | SCOPE_SUPER);
// Start a new scope with regard to loop labels

View File

@@ -1,3 +0,0 @@
{
"plugins": ["classStaticBlock"]
}

View File

@@ -1,6 +0,0 @@
class C {
static foo() {}
static {
this.bar = this.foo;
}
}

View File

@@ -1,3 +0,0 @@
{
"throws": "This experimental syntax requires enabling the parser plugin: 'classStaticBlock' (3:2)"
}

View File

@@ -1,6 +0,0 @@
{
"plugins": [
"classStaticBlock",
"classProperties"
]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["classStaticBlock", "classProperties"]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["classStaticBlock"]
}

View File

@@ -1,6 +1,3 @@
{
"plugins": [
"classStaticBlock",
["decorators", { "decoratorsBeforeExport": true }]
]
"plugins": [["decorators", { "decoratorsBeforeExport": true }]]
}

View File

@@ -1,3 +1,3 @@
{
"plugins": ["classStaticBlock", "decorators-legacy"]
"plugins": ["decorators-legacy"]
}

View File

@@ -1,5 +0,0 @@
{
"plugins": [
"classStaticBlock"
]
}

View File

@@ -1,3 +0,0 @@
{
"plugins": ["classStaticBlock"]
}

View File

@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:17)"
}
}

View File

@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:19)"
}
}

View File

@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:16)"
}
}

View File

@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:18)"
}
}

View File

@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:18)"
}
}

View File

@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:17)"
}
}

View File

@@ -1,12 +1,5 @@
{
"plugins": [
[
"classStaticBlock"
],
[
"typescript"
]
],
"plugins": ["typescript"],
"sourceType": "module",
"throws": "Unexpected token (2:18)"
}
}

View File

@@ -1,4 +1,4 @@
{
"plugins": ["classStaticBlock", "typescript"],
"plugins": ["typescript"],
"sourceType": "module"
}

View File

@@ -125,7 +125,7 @@ export type ParserPlugin =
| "classPrivateMethods"
| "classPrivateProperties"
| "classProperties"
| "classStaticBlock"
| "classStaticBlock" // Enabled by default
| "decimal"
| "decorators"
| "decorators-legacy"