-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return completions when yield* is used #20
Comments
SpiderMonkey implementation before #18: for (var innerValue of allowContentIterWith(item, method)) {
yield innerValue;
} Implementation after #18: // Step 3.a.i.
var iter = callContentFunction(method, item);
// Step 3.a.ii.
if (!IsObject(iter)) {
ThrowTypeError(JSMSG_GET_ITER_RETURNED_PRIMITIVE);
}
// Step 3.a.iii.
var iterNext = iter.next;
// Steps 3.a.iv-v.
var wrapped = {
next() {
return callContentFunction(iterNext, iter);
},
return() {
IteratorClose(item);
return {done: true, value: undefined};
},
};
yield* allowContentIterWithNext(wrapped, wrapped.next); |
This seems like the correct behaviour. What are you saying is undesirable about it? That it can't be implemented as literally function* concat(...iterables) {
for (const it of iterables) yield* it;
} ? |
Yes, it seems undesirable to add another wrapper to be able to use |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before #18:
When using
yield*
semantics:But the current spec requires something in between, because per spec return completions must always close the iterator, whereas
yield*
allows to continue after return completions.After #18:
The text was updated successfully, but these errors were encountered: