Implement for-await (ES2018) transform, fix existing ES2018 issues#2861
Draft
jakebailey wants to merge 22 commits intojabaile/es2017from
Draft
Implement for-await (ES2018) transform, fix existing ES2018 issues#2861jakebailey wants to merge 22 commits intojabaile/es2017from
jakebailey wants to merge 22 commits intojabaile/es2017from
Conversation
jakebailey
commented
Feb 20, 2026
| const cache = Object.create(null); | ||
| return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } }); | ||
| })(name => super[name], (name, value) => super[name] = value); | ||
| - const _super = Object.create(null, {}); |
Member
Author
There was a problem hiding this comment.
This variable is actually unreferenced, so this is in a way an improvement.
jakebailey
commented
Feb 20, 2026
| func (node *ReturnStatement) computeSubtreeFacts() SubtreeFacts { | ||
| return propagateSubtreeFacts(node.Expression) | ||
| // return in an ES2018 async generator must be awaited | ||
| return propagateSubtreeFacts(node.Expression) | SubtreeContainsForAwaitOrAsyncGenerator |
Member
Author
There was a problem hiding this comment.
Shockingly:
// @api
function createReturnStatement(expression?: Expression): ReturnStatement {
const node = createBaseNode<ReturnStatement>(SyntaxKind.ReturnStatement);
node.expression = expression;
// return in an ES2018 async generator must be awaited
node.transformFlags |= propagateChildFlags(node.expression) |
TransformFlags.ContainsES2018 |
TransformFlags.ContainsHoistedDeclarationOrCompletion;
node.jsDoc = undefined; // initialized by parser (JsDocContainer)
node.flowNode = undefined; // initialized by binder (FlowContainer)
return node;
}afc1c4b to
cbfd7ec
Compare
jakebailey
commented
Feb 20, 2026
Member
Author
There was a problem hiding this comment.
not new, but this is a bad emit bug itself somewhere
550880f to
57a50a6
Compare
c7ce39f to
e47e294
Compare
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.
On top of #2853.
Basically the same caveats apply.
Also fixes other diffs that I noticed once the for-await was done.