Open ExE-Boss opened 5 years ago
GetIterator
has been available since v1.11.0, afaik.
CreateAsyncFromSyncIterator
is tricky; i don't currently have the intrinsic for AsyncFromSyncIteratorPrototype
, so I'd need to add that as well; I'm also not sure that it's *possible to implement that in JS.
ES2018 added the optional hint
parameter to the GetIterator
abstract operation, in a backwards incompatible manner.
ah yes. I’d have to throw on an async hint, though, until the other method you request was available.
Actually, GetIterator(obj, 'async')
can be allowed return an async iterator if obj
has a Symbol.asyncIterator
property, and only throw when CreateAsyncFromSyncIterator
is needed.
Also, there’s no way to access %AsyncFromSyncIteratorPrototype%
from JS, and even if there were, you still couldn’t set its [[SyncIteratorRecord]]
internal slot.
right, so when would it be needed?
CreateAsyncFromSyncIterator
is needed when obj
doesn’t have a [Symbol.asyncIterator]()
method.
I’m currently writing a polyfill for the Iterator Helpers proposal, and I need these two methods.