Fix hoisting of function declarations in loops and switch#17691
Merged
nicolo-ribaudo merged 7 commits intobabel:mainfrom Jan 23, 2026
Merged
Fix hoisting of function declarations in loops and switch#17691nicolo-ribaudo merged 7 commits intobabel:mainfrom
nicolo-ribaudo merged 7 commits intobabel:mainfrom
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/60575 |
Member
Author
|
3d7e951 to
26e4d3a
Compare
|
commit: |
Member
Author
|
In Babel 8, we no longer need #16475, so I reverted it. |
…v` (babel#16475)" This reverts commit 3266872.
dd171d3 to
0159501
Compare
liuxingbaoyu
commented
Jan 6, 2026
Comment on lines
1
to
9
| { | ||
| "plugins": [ | ||
| "transform-block-scoped-functions", | ||
| "transform-block-scoping", | ||
| "syntax-jsx", | ||
| ["transform-react-jsx", { "runtime": "classic" }], | ||
| "transform-block-scoped-functions", | ||
| "transform-arrow-functions" | ||
| ] | ||
| } |
Member
Author
There was a problem hiding this comment.
Ideally, we should transform the new features first.
However, this is the order we've already used in preset-env, and it's simpler.
0159501 to
906140c
Compare
906140c to
70e15ee
Compare
nicolo-ribaudo
approved these changes
Jan 23, 2026
transform-block-scoped-functions| }; | ||
| if (true) { | ||
| function _run() { | ||
| var _run = function () { |
Member
There was a problem hiding this comment.
Is this necessary for something, or just a side-effect of the new transform?
Member
Author
There was a problem hiding this comment.
This is a side effect.
JLHwung
approved these changes
Jan 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes the regression introduced in #16398.
FunctionDeclarationbehaves differently in different versions of the specification.