Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple class static block, and follow the document order #12979

Closed
1 task
Kingwl opened this issue Mar 8, 2021 · 3 comments · Fixed by #12738
Closed
1 task

Allow multiple class static block, and follow the document order #12979

Kingwl opened this issue Mar 8, 2021 · 3 comments · Fixed by #12738
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@Kingwl
Copy link

Kingwl commented Mar 8, 2021

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

@babel-bot
Copy link
Collaborator

Hey @Kingwl! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."

@nicolo-ribaudo
Copy link
Member

Already tracked at #12738!

@Kingwl
Copy link
Author

Kingwl commented Mar 15, 2021

Thanks!

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jun 14, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants