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

Editorial: Specify Map/Set forEach more explicitly #2766

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -40044,9 +40044,15 @@ <h1>Map.prototype.forEach ( _callbackfn_ [ , _thisArg_ ] )</h1>
1. Perform ? RequireInternalSlot(_M_, [[MapData]]).
1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception.
1. Let _entries_ be the List that is _M_.[[MapData]].
1. For each Record { [[Key]], [[Value]] } _e_ of _entries_, do
1. Let _numEntries_ be the number of elements of _entries_.
1. Let _index_ be 0.
1. Repeat, while _index_ &lt; _numEntries_,
1. Let _e_ be the Record { [[Key]], [[Value]] } that is the value of _entries_[_index_].
1. Set _index_ to _index_ + 1.
1. If _e_.[[Key]] is not ~empty~, then
1. Perform ? Call(_callbackfn_, _thisArg_, &laquo; _e_.[[Value]], _e_.[[Key]], _M_ &raquo;).
1. NOTE: The number of elements in _entries_ may have increased during execution of _callbackfn_.
1. Set _numEntries_ to the number of elements of _entries_.
1. Return *undefined*.
</emu-alg>
<emu-note>
Expand Down Expand Up @@ -40181,7 +40187,7 @@ <h1>
1. Assert: _kind_ is ~key+value~.
1. Let _result_ be CreateArrayFromList(&laquo; _e_.[[Key]], _e_.[[Value]] &raquo;).
1. Perform ? GeneratorYield(CreateIterResultObject(_result_, *false*)).
1. NOTE: The number of elements in _entries_ may have changed while execution of this abstract operation was paused by Yield.
1. NOTE: The number of elements in _entries_ may have increased while execution of this abstract operation was paused by Yield.
1. Set _numEntries_ to the number of elements of _entries_.
1. Return *undefined*.
1. Return CreateIteratorFromClosure(_closure_, *"%MapIteratorPrototype%"*, %MapIteratorPrototype%).
Expand Down Expand Up @@ -40362,10 +40368,16 @@ <h1>Set.prototype.forEach ( _callbackfn_ [ , _thisArg_ ] )</h1>
1. Let _S_ be the *this* value.
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
1. If IsCallable(_callbackfn_) is *false*, throw a *TypeError* exception.
1. Let _entries_ be the List that is _S_.[[SetData]].
1. For each element _e_ of _entries_, do
1. Let _entries_ be the List that is _set_.[[SetData]].
1. Let _numEntries_ be the number of elements of _entries_.
1. Let _index_ be 0.
1. Repeat, while _index_ &lt; _numEntries_,
1. Let _e_ be _entries_[_index_].
1. Set _index_ to _index_ + 1.
1. If _e_ is not ~empty~, then
1. Perform ? Call(_callbackfn_, _thisArg_, &laquo; _e_, _e_, _S_ &raquo;).
1. NOTE: The number of elements in _entries_ may have increased during execution of _callbackfn_.
1. Set _numEntries_ to the number of elements of _entries_.
1. Return *undefined*.
</emu-alg>
<emu-note>
Expand Down Expand Up @@ -40470,7 +40482,7 @@ <h1>
1. Else,
1. Assert: _kind_ is ~value~.
1. Perform ? GeneratorYield(CreateIterResultObject(_e_, *false*)).
1. NOTE: The number of elements in _entries_ may have changed while execution of this abstract operation was paused by Yield.
1. NOTE: The number of elements in _entries_ may have increased while execution of this abstract operation was paused by Yield.
1. Set _numEntries_ to the number of elements of _entries_.
1. Return *undefined*.
1. Return CreateIteratorFromClosure(_closure_, *"%SetIteratorPrototype%"*, %SetIteratorPrototype%).
Expand Down