Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements the ES2017 async/await transform, converting async functions and arrow functions to use generator-based __awaiter helpers when targeting ES2015 or earlier. The implementation is a pure port from the TypeScript reference implementation with improvements to arguments and super handling.
Changes:
- Async functions are transformed to regular functions returning
__awaiter()calls with generator functions awaitexpressions are converted toyieldexpressions within the generator- Improved handling of
argumentscapturing andsuperproperty access without relying on checker flags
Reviewed changes
Copilot reviewed 299 out of 445 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| testdata/baselines/reference/submodule/**/*.diff | Deleted diffs showing convergence with TypeScript output for async transforms |
| testdata/baselines/reference/submodule/**/*.js | Updated baselines showing async functions now emit __awaiter helper calls |
| internal/printer/helpers.go | Added __awaiter, AsyncSuperHelper, and AdvancedAsyncSuperHelper emit helpers |
| internal/printer/printer.go | Fixed binary expression precedence for yield in assignments |
| internal/printer/emitflags.go | Added EFAsyncFunctionBody and EFNoSubstitution flags |
| internal/printer/emitresolver.go | Added IsArgumentsLocalBinding method for arguments detection |
| internal/checker/emitresolver.go | Implemented IsArgumentsLocalBinding to check if identifier refers to arguments |
| internal/checker/types.go | Removed unused NodeCheckFlags for async super and arguments |
| internal/checker/checker.go | Removed commented code for async super property checks |
| internal/transformers/tstransforms/utilities.go | Removed convertEntityNameToExpression (moved to factory) |
| internal/transformers/tstransforms/runtimesyntax.go | Updated to use factory method for entity name conversion |
| internal/transformers/jsxtransforms/utilities.go | Deleted file (functionality moved to factory) |
| internal/transformers/jsxtransforms/jsx.go | Updated to use factory method for entity name conversion |
testdata/baselines/reference/submodule/conformance/asyncUseStrict_es5(target=es2015).js
Show resolved
Hide resolved
jakebailey
commented
Feb 20, 2026
jakebailey
commented
Feb 20, 2026
jakebailey
commented
Feb 20, 2026
testdata/baselines/reference/submodule/compiler/sourceMapValidationImport.sourcemap.txt.diff
Outdated
Show resolved
Hide resolved
jakebailey
commented
Feb 20, 2026
jakebailey
commented
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
weswigham
reviewed
Feb 20, 2026
Comment on lines
+179
to
+181
| printer.makeFileLevelOptimisticUniqueName = func(name string) string { | ||
| return printer.nameGenerator.MakeFileLevelOptimisticUniqueName(name) | ||
| } |
Member
There was a problem hiding this comment.
Why is this not just
Suggested change
| printer.makeFileLevelOptimisticUniqueName = func(name string) string { | |
| return printer.nameGenerator.MakeFileLevelOptimisticUniqueName(name) | |
| } | |
| printer.makeFileLevelOptimisticUniqueName = printer.nameGenerator.MakeFileLevelOptimisticUniqueName |
?
But moreover, why is it not just a method on printer?
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 is just one transform. It's pretty much a pure port, with some differences:
argumentscapturing is not done viaNodeCheckflags. While declared, the checker does not currently set them, and it's possible to get this info without requiring checking. I think this is a net improvement.superdetection is similarly changed, but also handles rewriting directly rather than relying on emit hooks.Promiseconstructor.All diffs related to this get deleted (yay), except the ones that are still missing the ES2018 transform for async-for.