Skip to content
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
74 changes: 74 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -43650,6 +43650,43 @@ <h1>Map.prototype.get ( _key_ )</h1>
</emu-alg>
</emu-clause>

<emu-clause id="sec-map.prototype.getorinsert">
<h1>Map.prototype.getOrInsert ( _key_, _value_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _M_ be the *this* value.
1. Perform ? RequireInternalSlot(_M_, [[MapData]]).
1. Set _key_ to CanonicalizeKeyedCollectionKey(_key_).
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]].
1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }.
1. Append _p_ to _M_.[[MapData]].
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-map.prototype.getorinsertcomputed">
<h1>Map.prototype.getOrInsertComputed ( _key_, _callback_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _M_ be the *this* value.
1. Perform ? RequireInternalSlot(_M_, [[MapData]]).
1. If IsCallable(_callback_) is *false*, throw a *TypeError* exception.
1. Set _key_ to CanonicalizeKeyedCollectionKey(_key_).
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]].
1. Let _value_ be ? Call(_callback_, *undefined*, « _key_ »).
1. NOTE: The Map may have been modified during execution of _callback_.
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, then
1. Set _p_.[[Value]] to _value_.
1. Return _value_.
1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }.
1. Append _p_ to _M_.[[MapData]].
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-map.prototype.has">
<h1>Map.prototype.has ( _key_ )</h1>
<p>This method performs the following steps when called:</p>
Expand Down Expand Up @@ -44526,6 +44563,43 @@ <h1>WeakMap.prototype.get ( _key_ )</h1>
</emu-alg>
</emu-clause>

<emu-clause id="sec-weakmap.prototype.getorinsert">
<h1>WeakMap.prototype.getOrInsert ( _key_, _value_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _M_ be the *this* value.
1. Perform ? RequireInternalSlot(_M_, [[WeakMapData]]).
1. If CanBeHeldWeakly(_key_) is *false*, throw a *TypeError* exception.
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]].
1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }.
1. Append _p_ to _M_.[[WeakMapData]].
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-weakmap.prototype.getorinsertcomputed">
<h1>WeakMap.prototype.getOrInsertComputed ( _key_, _callback_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _M_ be the *this* value.
1. Perform ? RequireInternalSlot(_M_, [[WeakMapData]]).
1. If CanBeHeldWeakly(_key_) is *false*, throw a *TypeError* exception.
1. If IsCallable(_callback_) is *false*, throw a *TypeError* exception.
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]].
1. Let _value_ be ? Call(_callback_, *undefined*, « _key_ »).
1. NOTE: The WeakMap may have been modified during execution of _callback_.
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, then
1. Set _p_.[[Value]] to _value_.
1. Return _value_.
1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }.
1. Append _p_ to _M_.[[WeakMapData]].
1. Return _value_.
</emu-alg>
</emu-clause>

<emu-clause id="sec-weakmap.prototype.has">
<h1>WeakMap.prototype.has ( _key_ )</h1>
<p>This method performs the following steps when called:</p>
Expand Down
Loading