Skip to content

Conversation

@rbuckton
Copy link
Contributor

@rbuckton rbuckton commented May 29, 2018

This fixes two issues in __generator:

  1. We do not correctly handle iter.return() when in a yield*, as per 14.4.13 step 7.c.viii.2.
  2. We do not correctly close the iterator delegated via yield* during iter.throw() when the delegated iterator does not have a throw method, as per 14.4.13 step 7.b.iii.4

This PR makes two changes to the __generator helper to fix these issues (respectively):

  1. We fix iter.return() on generators.ts:3256 by preserving the "return" opcode (2).
  2. We fix iter.throw() on generators.ts:3255 when y.throw is not present by calling (and ignoring the result of) y.return() if it exists.

Fixes #24288

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.

I still wish we had functional tests for these helpers, tho.

@rbuckton
Copy link
Contributor Author

Sounds like something we should consider as part of the test262 tests?

@rbuckton rbuckton merged commit c1a5d9b into master May 29, 2018
@rbuckton rbuckton deleted the fix24288 branch May 29, 2018 20:34
@rbuckton
Copy link
Contributor Author

rbuckton commented Jun 7, 2018

@mhegazy do you want this ported to release-2.9 as well?

@mhegazy
Copy link
Contributor

mhegazy commented Jun 7, 2018

yes please.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generator with closure does not correctly handle return()

4 participants