zenparsing / es6now

ECMAScript 6 to 5 Compiler and Runtime Environment
MIT License
29 stars 2 forks source link

Experimentally Translate Async Generator Functions #26

Closed zenparsing closed 10 years ago

zenparsing commented 10 years ago

Async generator functions should produce, when called, an async generators. Async generators have the same methods as regular generators (next, throw, and return), but each method returns a promise for an InteratorResult.

zenparsing commented 10 years ago

I believe this can be achieved by translating await calls into yields where the yield argument is an instance of a magic class.

We'll have an async runner which resembles the runner used for regular async functions. When the generator yields an instance of the magic class, then we resolve-and-feed in the normal async runner style. Otherwise, we enqueue the result in an output queue.

zenparsing commented 10 years ago

Initial work complete in 618b8a89248b8645c5a7d099414fcd70721f344d