Filed https://github.com/tc39/ecma262/issues/1497 to track this.
Sounds to me like a spec bug.

-----

Isiah Meadows
[email protected]
www.isiahmeadows.com

-----

Isiah Meadows
[email protected]
www.isiahmeadows.com


On Mon, Apr 1, 2019 at 7:00 AM Simo Costa <[email protected]> wrote:
>
> Currently the following illustrative syntax is forbidden:
> ```js
> obj = {
>     async*[Symbol.asyncIterator]() {
>         const res = await yield;
>         // do stuff with res
>      }
> }
> ```
> Used in this way (simple example):
> ```js
> const ait = [Symbol.asyncIterator]();
>
> ait.next();
> ait.next(p); // p is a Promise
> ```
>
> We cannot directly write `await yield`. Is there any particular reason?
> We have to write:
> ```js
> obj = {
>     async*[Symbol.asyncIterator]() {
>         const p = yield;
>         const res = await p;
>         // do stuff with res
>      }
> }
> ```
>
>
>
>
> Mail priva di virus. www.avast.com
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to