Skip to content

Commit

Permalink
rename enums in GetIteratorFlattenable
Browse files Browse the repository at this point in the history
also split up the steps and add an assert for better understandability
  • Loading branch information
michaelficarra committed Aug 16, 2024
1 parent 0bf3656 commit 78c9237
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -7000,14 +7000,16 @@ <h1>
<h1>
GetIteratorFlattenable (
_obj_: an ECMAScript language value,
_stringHandling_: ~iterate-strings~ or ~reject-strings~,
_primitiveHandling_: ~iterate-string-primitives~ or ~reject-primitives~,
): either a normal completion containing an Iterator Record or a throw completion
</h1>
<dl class="header">
</dl>
<emu-alg>
1. If _obj_ is not an Object, then
1. If _stringHandling_ is ~reject-strings~ or _obj_ is not a String, throw a *TypeError* exception.
1. If _primitiveHandling_ is ~reject-primitives~, throw a *TypeError* exception.
1. Assert: _primitiveHandling_ is ~iterate-string-primitives~.
1. If _obj_ is not a String, throw a *TypeError* exception.
1. Let _method_ be ? GetMethod(_obj_, %Symbol.iterator%).
1. If _method_ is *undefined*, then
1. Let _iterator_ be _obj_.
Expand Down Expand Up @@ -46574,7 +46576,7 @@ <h1>Iterator.prototype</h1>
<emu-clause id="sec-iterator.from">
<h1>Iterator.from ( _O_ )</h1>
<emu-alg>
1. Let _iteratorRecord_ be ? GetIteratorFlattenable(_O_, ~iterate-strings~).
1. Let _iteratorRecord_ be ? GetIteratorFlattenable(_O_, ~iterate-string-primitives~).
1. Let _hasInstance_ be ? OrdinaryHasInstance(%Iterator%, _iteratorRecord_.[[Iterator]]).
1. If _hasInstance_ is *true*, then
1. Return _iteratorRecord_.[[Iterator]].
Expand Down Expand Up @@ -46813,7 +46815,7 @@ <h1>Iterator.prototype.flatMap ( _mapper_ )</h1>
1. If _value_ is ~done~, return *undefined*.
1. Let _mapped_ be Completion(Call(_mapper_, *undefined*, « _value_, 𝔽(_counter_) »)).
1. IfAbruptCloseIterator(_mapped_, _iterated_).
1. Let _innerIterator_ be Completion(GetIteratorFlattenable(_mapped_, ~reject-strings~)).
1. Let _innerIterator_ be Completion(GetIteratorFlattenable(_mapped_, ~reject-primitives~)).
1. IfAbruptCloseIterator(_innerIterator_, _iterated_).
1. Let _innerAlive_ be *true*.
1. Repeat, while _innerAlive_ is *true*,
Expand Down

0 comments on commit 78c9237

Please sign in to comment.