Closed zenparsing closed 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.
Initial work complete in 618b8a89248b8645c5a7d099414fcd70721f344d
Async generator functions should produce, when called, an async generators. Async generators have the same methods as regular generators (
next
,throw
, andreturn
), but each method returns a promise for anInteratorResult
.