Repository navigation
fix: preserve comments following async function wrappers - #18644
Merged
Merged
Conversation
Collaborator
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/63401 |
|
commit: |
JLHwung
approved these changes
Nov 17, 2026
JLHwung
left a comment
Contributor
There was a problem hiding this comment.
Thank you for opening your first PR. Please remove comments from the src, the implementation is straightforward.
Per our AI policy, please disclose in the commit message if this PR is AI-assisted.
Contributor
Author
|
@JLHwung Comments removed! |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 19, 2026
Collaborator
|
Backported to 7.x in #18667. |
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 comment placement when an async function declaration is split into the public wrapper (
a) and the generated implementation (_a). One comment is attached as both a trailing comment on the preceding export and a leading comment on the following export. Previously, the comment would remain attached to the respective functions in the respective orders while the generated implementation (_a) was inserted after the outerexportfunction. This fix moves trailing comments from the original statement onto_a, the generated function. This preserves a following function's documentation comment above that function.Before this change, Babel wrote the comment for
bbefore the generated_aimplementation:After this change,
_ais written beforeb's documentation comment:This PR also adds a regression fixture to the
@babel/plugin-transform-async-to-generatorsuite. It defines an input and expected output, which is compared against Babel's generated output.