Skip to content

Await should only get the promise's constructor property once #6163

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 1 commit into from
Jun 14, 2019

Conversation

zenparsing
Copy link
Contributor

@zenparsing zenparsing commented Jun 13, 2019

Fixes #6162

Currently, await will trigger two gets for the operand's "constructor" property: once when doing Promise.resolve and then again in the call to CreateThenPromise.

This change introduces PerformPromiseThen, a new function parallel to the spec's abstract operation of the same name, that takes a promise capability instead of creating a new one, along with:

  • Some refactorings around "resolve"-type internal functions.
  • A new UnunsedPromiseCapability function, which can be optimized in the future for await scenarios.
  • Formatting changes for readability (writing and reviewing code is much easier for those working on laptops if line lengths are kept under 120).

Copy link
Contributor

@boingoing boingoing left a comment

Choose a reason for hiding this comment

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

Nice, looks good to me.

@chakrabot chakrabot merged commit a5cda3c into chakra-core:master Jun 14, 2019
chakrabot pushed a commit that referenced this pull request Jun 14, 2019
…ctor property once

Merge pull request #6163 from zenparsing:promise-get-constructor

Fixes #6162

Currently, `await` will trigger two gets for the operand's "constructor" property: once when doing `Promise.resolve` and then again in the call to `CreateThenPromise`.

This change introduces `PerformPromiseThen`, a new function parallel to the spec's abstract operation of the same name, that takes a promise capability instead of creating a new one.
chakrabot pushed a commit that referenced this pull request Jun 24, 2019
Merge pull request #6172 from rhuanjl:asyncGeneratorFixes

I missed async generator properties of objects when updating the parser in #5834

This PR:
1. fixes that omission enabling async generator properties of objects when async generators are enabled
2. adds tests for a couple of async generator syntax options that were not currently tested (including for point 1)
3. updates the async generator continue methods to use the new PerformPromiseThen from #6163 - this has no observable effect but improves internal consistency

@zenparsing please could you take a look at this?
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.

Await should get the promise's constructor property only once
3 participants