tc39/proposal-async-iteration

getIterator can return an AsyncFromSyncIterator instead of a record

Jamesernator opened this issue · 0 comments

Something I didn't notice before when looking over the pull request #119 is that getIterator can return either an iterator record or an AsyncFromSyncIterator. Instead of returning CreateAsyncFromSyncIterator(syncIteratorRecord) we want an actual iterator record for that.

A simple change should just be to replace:

return ? CreateAsyncFromSyncIterator(syncIteratorRecord)

with:

let asyncFromSyncIterator be ? CreateAsyncFromSyncIterator(syncIteratorRecord)
return getIterator(asyncFromSyncIterator, "async")