Skip to content
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

fixes #228: fail earlier when an iterable produces a broken iterator #232

Merged
merged 2 commits into from Sep 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions spec.html
Expand Up @@ -214,6 +214,7 @@ <h1>Iterator.from ( _O_ )</h1>
1. Let _usingIterator_ be ? GetMethod(_O_, @@iterator).
1. If _usingIterator_ is not *undefined*, then
1. Let _iteratorRecord_ be ? GetIterator(_O_, ~sync~, _usingIterator_).
1. If IsCallable(_iteratorRecord_.[[NextMethod]]) is *false*, throw a *TypeError* exception.
1. Let _hasInstance_ be ? OrdinaryHasInstance(%Iterator%, _iteratorRecord_.[[Iterator]]).
1. If _hasInstance_ is *true*, then
1. Return _iteratorRecord_.[[Iterator]].
Expand Down Expand Up @@ -296,13 +297,15 @@ <h1>AsyncIterator.from ( _O_ )</h1>
1. Let _iteratorRecord_ be *undefined*.
1. If _usingIterator_ is not *undefined*, then
1. Set _iteratorRecord_ to ? GetIterator(_O_, ~async~, _usingIterator_).
1. If IsCallable(_iteratorRecord_.[[NextMethod]]) is *false*, throw a *TypeError* exception.
1. Let _hasInstance_ be ? OrdinaryHasInstance(%AsyncIterator%, _iteratorRecord_.[[Iterator]]).
1. If _hasInstance_ is *true*, then
1. Return _iteratorRecord_.[[Iterator]].
1. If _iteratorRecord_ is *undefined*, then
1. Set _usingIterator_ to ? GetMethod(_O_, @@iterator).
1. If _usingIterator_ is not *undefined*, then
1. Let _syncIteratorRecord_ be ? GetIterator(_O_, ~sync~, _usingIterator_).
1. If IsCallable(_syncIteratorRecord_.[[NextMethod]]) is *false*, throw a *TypeError* exception.
1. Set _iteratorRecord_ to CreateAsyncFromSyncIterator(_syncIteratorRecord_).
1. If _iteratorRecord_ is *undefined*, set _iteratorRecord_ to ? GetIteratorDirect(_O_).
1. Let _wrapper_ be ! ObjectCreate(%WrapForValidAsyncIteratorPrototype%, &laquo; [[AsyncIterated]] &raquo;).
Expand Down