You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
Something I noticed when implementing a small set of utilities (see here) for dealing with iterators I noticed that regardless of whether a value is actually passed or not to AsyncFromSyncIteratorPrototype.next one is passed forward to the syncIterator.next method regardless.
This is observable with the following code fragment:
consto={[Symbol.iterator](){returnthis},next(...args){console.log(JSON.stringify(args))return{done: true}}}asyncfunctiontest(){forawait(constitemofo){}}test()// Prints [null] in the d8 shell// not sure where the null could come from in the spec
The synchronous version of the loop has no such value:
consto={[Symbol.iterator](){returnthis},next(...args){console.log(JSON.stringify(args))return{done: true}}}functiontest(){for(constitemofo){}}test()// Prints [] as I'd expected
Neither does the async iterator version of the loop:
consto={[Symbol.asyncIterator](){returnthis},next(...args){console.log(JSON.stringify(args))returnPromise.resolve({done: true})}}asyncfunctiontest(){forawait(constitemofo){}}test()// Prints [] as I'd expected
I'm not sure if this is intentional but if it isn't then it should probably be the case that .return and .throw also receive the change to fix .next.
The text was updated successfully, but these errors were encountered:
I should note that the specific part of the spec I'm referring to is this function but more specifically part 5 which calls IteratorNext with value regardless of if one was passed or not.
Something I noticed when implementing a small set of utilities (see here) for dealing with iterators I noticed that regardless of whether a value is actually passed or not to
AsyncFromSyncIteratorPrototype.next
one is passed forward to thesyncIterator.next
method regardless.This is observable with the following code fragment:
The synchronous version of the loop has no such value:
Neither does the async iterator version of the loop:
I'm not sure if this is intentional but if it isn't then it should probably be the case that
.return
and.throw
also receive the change to fix.next
.The text was updated successfully, but these errors were encountered: