Skip to content

Update __awaiter to be more spec compliant #32462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2019
Merged

Update __awaiter to be more spec compliant #32462

merged 2 commits into from
Jul 23, 2019

Conversation

rbuckton
Copy link
Contributor

Updates the __awaiter helper to be closer to the spec. new Promise(resolve => resolve(value)) takes one turn more than Promise.resolve(value). However, we do not (and cannot) rely on the existence of Promise.resolve down-level, so we do the next best thing and test value instanceof P (where P may be a custom Promise-like constructor.

A similar change will need to be made to tslib, and is forthcoming.

Fixes #31552.

@rbuckton
Copy link
Contributor Author

CC: @weswigham, @RyanCavanaugh (since I can't add reviewers)

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Can we add evaluator tests (i imagine they'd need to be async) that demonstrate the potential sequencing difference?

@rbuckton
Copy link
Contributor Author

Possibly, though we might be up to the whims of future spec changes and newer versions of node/v8.

@rbuckton rbuckton merged commit d982014 into master Jul 23, 2019
@rbuckton rbuckton deleted the fix31552 branch July 27, 2019 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

async/await/Promise scheduling order wrong
2 participants