Skip to content

Allow variable and function with the same name in static blocks#14344

Merged
JLHwung merged 10 commits intobabel:mainfrom
Yokubjon-J:fix-14336
Mar 10, 2022
Merged

Allow variable and function with the same name in static blocks#14344
JLHwung merged 10 commits intobabel:mainfrom
Yokubjon-J:fix-14336

Conversation

@Yokubjon-J
Copy link
Copy Markdown
Contributor

@Yokubjon-J Yokubjon-J commented Mar 9, 2022

Q                       A
Fixed Issues? Fixes #14257
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Allow a variable and a function to have a same name in a static block

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Mar 9, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/51459/

@Yokubjon-J
Copy link
Copy Markdown
Contributor Author

I wonder why babel bot shows another issue (not about static block) in REPL...

@nicolo-ribaudo nicolo-ribaudo changed the title Fix 14336 Allow variable and function with the same name in static blocks Mar 9, 2022
@nicolo-ribaudo nicolo-ribaudo added pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Class Static Block labels Mar 9, 2022
@nicolo-ribaudo
Copy link
Copy Markdown
Member

You can edit the REPL contents to whatever you want 😉

Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI failure is not related to this PR, it's a flaky test that sometimes fails.

Copy link
Copy Markdown
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static block is an ES2022 feature, can you move the test case to es2022? There is a static block folder over there. I think it suffices to add only one test case.

@Yokubjon-J
Copy link
Copy Markdown
Contributor Author

I have created a new subdirectory: ...\es2022\class-private-names-duplicated\static-block-duplicate-name. The test has passed.

Comment thread packages/babel-runtime-corejs3/helpers/esm/possibleConstructorReturn.js Outdated
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@JLHwung JLHwung merged commit bae5027 into babel:main Mar 10, 2022
@nicolo-ribaudo nicolo-ribaudo deleted the fix-14336 branch March 10, 2022 19:12
@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 10, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Class Static Block

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Parser throws when var declaration and function declaration in class static block

4 participants