Closed GeorgNeis closed 7 years ago
I'm going to go with "intended". The protocol intentionally ignores any last values.
Oh, no, I forgot, the completion value of yield*
is the last value. OK, so that's a bug.
where does yield*
await on "value" for not-last ones ?
Via GeneratorYield
, yield*
passes such a value to AsyncGeneratorResolve
, which resolves a new promise with it:
Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « value »).
It then feeds this promise into the result promise from the queue:
Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]], onFulfilled, undefined, promiseCapability).
In the case where value
is itself a promise, this has the effect of yield*
awaiting on it.
Basically the important thing is that value
should not be a promise. It would be ideal if we didn't have two mechanisms for doing this, one in yield*
and one in AsyncGeneratorResolve. But I am not sure how to accomplish that, and the version in #92 seems pretty straightforward.
yield* foo
awaits on thevalue
component of each result offoo
, except for the last one (the one whosedone
component is true). I'm unsure if this is intended or a bug. If it is intended, I think it's worth having an explicit note about it in the spec.@ajklein: FYI