Bug 156576 - [ES7] yield star should not return if the inner iterator.throw returns { done: true }
Summary: [ES7] yield star should not return if the inner iterator.throw returns { done...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-14 05:50 PDT by Yusuke Suzuki
Modified: 2016-04-18 00:35 PDT (History)
9 users (show)

See Also:


Attachments
Patch (16.80 KB, patch)
2016-04-14 05:54 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (16.72 KB, patch)
2016-04-14 06:37 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (16.56 KB, patch)
2016-04-14 06:40 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2016-04-14 05:50:56 PDT
[ES6] yield star should not return if the inner iterator.throw returns { done: true }
Comment 1 Yusuke Suzuki 2016-04-14 05:54:58 PDT
Created attachment 276391 [details]
Patch
Comment 2 Yusuke Suzuki 2016-04-14 05:55:44 PDT
This change is also listed here. http://kangax.github.io/compat-table/esnext/
Comment 3 Yusuke Suzuki 2016-04-14 06:37:06 PDT
Created attachment 276395 [details]
Patch
Comment 4 Yusuke Suzuki 2016-04-14 06:40:15 PDT
Created attachment 276396 [details]
Patch
Comment 5 Yusuke Suzuki 2016-04-14 06:42:54 PDT
Comment on attachment 276396 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=276396&action=review

> Source/JavaScriptCore/builtins/GeneratorPrototype.js:83
> +    return @generatorResume(this, exception, @GeneratorResumeModeThrow);

Use bytecode intrinsic constants. We can keep in sync with JSGenerator::constants.

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:4442
> +                    emitThrowTypeError(ASCIILiteral("Iterator result interface is not an object."));

When innerIterator.throw() does not throw, we fall into the usual iteration path (branchOnResult).

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:4491
> +            emitLabel(branchOnResult.get());

The iterator loop's condition phase.
Comment 6 Yusuke Suzuki 2016-04-17 15:39:34 PDT
Note that this is not staging change. It is already introduced into the spec draft (ECMAScript 2016 spec).
Comment 7 Darin Adler 2016-04-17 16:18:14 PDT
Comment on attachment 276396 [details]
Patch

Looks OK to me, but it’s slightly outside my expertise which is why I am not marking it review+
Comment 8 Saam Barati 2016-04-17 20:24:05 PDT
Comment on attachment 276396 [details]
Patch

r=me
Comment 9 Yusuke Suzuki 2016-04-17 23:51:57 PDT
Comment on attachment 276396 [details]
Patch

Thanks!
Comment 10 WebKit Commit Bot 2016-04-18 00:35:35 PDT
Comment on attachment 276396 [details]
Patch

Clearing flags on attachment: 276396

Committed r199652: <http://trac.webkit.org/changeset/199652>
Comment 11 WebKit Commit Bot 2016-04-18 00:35:41 PDT
All reviewed patches have been landed.  Closing bug.