Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed Sep 23, 2022
1 parent 7f36844 commit 57725e3
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,29 +154,27 @@ <h1>
<h1>
GetIteratorFlattenable (
_obj_: an ECMAScript language value,
optional _hint_: ~sync~ or ~async~,
_hint_: ~sync~ or ~async~,
): either a normal completion containing an Iterator Record or a throw completion
</h1>
<dl class="header">
</dl>
<emu-alg>
1. If _hint_ is not present, set _hint_ to ~sync~.
1. If _iterator_ is either *undefined* or *null*, throw a *TypeError* exception.
1. If _obj_ is not an Object, throw a *TypeError* exception.
1. Let _alreadyAsync_ be *false*.
1. Let _method_ be *undefined*.
1. If _hint_ is ~async~, then
1. Set _method_ to ? GetV(_obj_, @@asyncIterator).
1. Set _method_ to ? Get(_obj_, @@asyncIterator).
1. Set _alreadyAsync_ to *true*.
1. If IsCallable(_method_) is *false*, then
1. Set _method_ to ? GetV(_obj_, @@iterator).
1. Set _method_ to ? Get(_obj_, @@iterator).
1. Set _alreadyAsync_ to *false*.
1. If IsCallable(_method_) is *false*, then
1. Let _iterator_ be _obj_.
1. Set _alreadyAsync_ to *true*.
1. Else,
1. Let _iterator_ be ? Call(_method_, _obj_).
1. If _iterator_ is not an Object, throw a *TypeError* exception.
1. Let _nextMethod_ be ? Get(_iterator_, *"next"*).
1. Let _nextMethod_ be ? GetV(_iterator_, *"next"*).
1. If IsCallable(_nextMethod_) is *false*, throw a *TypeError* exception.
1. Let _iteratorRecord_ be the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
1. If _hint_ is ~async~ and _alreadyAsync_ is *false*, then
Expand Down Expand Up @@ -246,14 +244,10 @@ <h1>Iterator.prototype</h1>
<emu-clause id="sec-iterator.from">
<h1>Iterator.from ( _O_ )</h1>
<emu-alg>
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]].
1. Else, Let _iteratorRecord_ be ? GetIteratorDirect(_O_).
1. Let _iteratorRecord_ be GetIteratorFlattenable(_mapped_, ~sync~).
1. Let _hasInstance_ be ? OrdinaryHasInstance(%Iterator%, _iteratorRecord_.[[Iterator]]).
1. If _hasInstance_ is *true*, then
1. Return _iteratorRecord_.[[Iterator]].
1. Let _wrapper_ be OrdinaryObjectCreate(%WrapForValidIteratorPrototype%, « [[Iterated]] »).
1. Set _wrapper_.[[Iterated]] to _iteratorRecord_.
1. Return _wrapper_.
Expand Down Expand Up @@ -328,21 +322,7 @@ <h1>AsyncIterator.prototype</h1>
<emu-clause id="sec-asynciterator.from">
<h1>AsyncIterator.from ( _O_ )</h1>
<emu-alg>
1. Let _usingIterator_ be ? GetMethod(_O_, @@asyncIterator).
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 _iteratorRecord_ be GetIteratorFlattenable(_mapped_, ~sync~).
1. Let _wrapper_ be OrdinaryObjectCreate(%WrapForValidAsyncIteratorPrototype%, « [[AsyncIterated]] »).
1. Set _wrapper_.[[AsyncIterated]] to _iteratorRecord_.
1. Return _wrapper_.
Expand Down

0 comments on commit 57725e3

Please # to comment.