-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Allow multiple class static block, and follow the document order #12979
Copy link
Copy link
Closed
Labels
i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Bug Report
- I would like to work on a fix!
Current behavior
According to https://github.com/tc39/proposal-class-static-block
A class may have any number of static {} initialization blocks in its class body.
static {} initialization blocks are evaluated in document order interleaved with static field initializers.
Input Code
class C {
static f = 1
static { console.log(this.f, this.ff) }
static ff = 2
static { console.log(this.ff, this.fff) }
static fff = 3
}Expected behavior
Multiple block works fine. And the evaluate order follow the document order.
But currently:
Duplicate static block in the same class (5:2)
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
{
"your": { "config": "here" }
}Environment
- Babel version(s): [e.g. v7.12.0]
- Node/npm version: [e.g. Node 12/npm 7]
- OS: [e.g. macOS 10.15.4, Windows 10]
- Monorepo: [e.g. yes/no/Lerna]
- How you are using Babel: [e.g.
webpack,rollup,parcel,babel-register]
Possible Solution
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue