Skip to content

Commit 30257dd

Browse files
bakkotljharb
authored andcommitted
Editorial: introduce CanonicalizeKeyedCollectionKey (#3337)
1 parent 6e70429 commit 30257dd

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

spec.html

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6811,7 +6811,7 @@ <h1>
68116811
1. IfAbruptCloseIterator(_key_, _iteratorRecord_).
68126812
1. Else,
68136813
1. Assert: _keyCoercion_ is ~zero~.
6814-
1. If _key_ is *-0*<sub>𝔽</sub>, set _key_ to *+0*<sub>𝔽</sub>.
6814+
1. Set _key_ to CanonicalizeKeyedCollectionKey(_key_).
68156815
1. Perform AddValueToKeyedGroup(_groups_, _key_, _value_).
68166816
1. Set _k_ to _k_ + 1.
68176817
</emu-alg>
@@ -41809,8 +41809,9 @@ <h1>Map.prototype.delete ( _key_ )</h1>
4180941809
<emu-alg>
4181041810
1. Let _M_ be the *this* value.
4181141811
1. Perform ? RequireInternalSlot(_M_, [[MapData]]).
41812+
1. Set _key_ to CanonicalizeKeyedCollectionKey(_key_).
4181241813
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
41813-
1. If _p_.[[Key]] is not ~empty~ and SameValueZero(_p_.[[Key]], _key_) is *true*, then
41814+
1. If _p_.[[Key]] is not ~empty~ and _p_.[[Key]] is _key_, then
4181441815
1. Set _p_.[[Key]] to ~empty~.
4181541816
1. Set _p_.[[Value]] to ~empty~.
4181641817
1. Return *true*.
@@ -41863,8 +41864,9 @@ <h1>Map.prototype.get ( _key_ )</h1>
4186341864
<emu-alg>
4186441865
1. Let _M_ be the *this* value.
4186541866
1. Perform ? RequireInternalSlot(_M_, [[MapData]]).
41867+
1. Set _key_ to CanonicalizeKeyedCollectionKey(_key_).
4186641868
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
41867-
1. If _p_.[[Key]] is not ~empty~ and SameValueZero(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]].
41869+
1. If _p_.[[Key]] is not ~empty~ and _p_.[[Key]] is _key_, return _p_.[[Value]].
4186841870
1. Return *undefined*.
4186941871
</emu-alg>
4187041872
</emu-clause>
@@ -41875,8 +41877,9 @@ <h1>Map.prototype.has ( _key_ )</h1>
4187541877
<emu-alg>
4187641878
1. Let _M_ be the *this* value.
4187741879
1. Perform ? RequireInternalSlot(_M_, [[MapData]]).
41880+
1. Set _key_ to CanonicalizeKeyedCollectionKey(_key_).
4187841881
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
41879-
1. If _p_.[[Key]] is not ~empty~ and SameValueZero(_p_.[[Key]], _key_) is *true*, return *true*.
41882+
1. If _p_.[[Key]] is not ~empty~ and _p_.[[Key]] is _key_, return *true*.
4188041883
1. Return *false*.
4188141884
</emu-alg>
4188241885
</emu-clause>
@@ -41896,11 +41899,11 @@ <h1>Map.prototype.set ( _key_, _value_ )</h1>
4189641899
<emu-alg>
4189741900
1. Let _M_ be the *this* value.
4189841901
1. Perform ? RequireInternalSlot(_M_, [[MapData]]).
41902+
1. Set _key_ to CanonicalizeKeyedCollectionKey(_key_).
4189941903
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
41900-
1. If _p_.[[Key]] is not ~empty~ and SameValueZero(_p_.[[Key]], _key_) is *true*, then
41904+
1. If _p_.[[Key]] is not ~empty~ and _p_.[[Key]] is _key_, then
4190141905
1. Set _p_.[[Value]] to _value_.
4190241906
1. Return _M_.
41903-
1. If _key_ is *-0*<sub>𝔽</sub>, set _key_ to *+0*<sub>𝔽</sub>.
4190441907
1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }.
4190541908
1. Append _p_ to _M_.[[MapData]].
4190641909
1. Return _M_.
@@ -42091,10 +42094,10 @@ <h1>Set.prototype.add ( _value_ )</h1>
4209142094
<emu-alg>
4209242095
1. Let _S_ be the *this* value.
4209342096
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
42097+
1. Set _value_ to CanonicalizeKeyedCollectionKey(_value_).
4209442098
1. For each element _e_ of _S_.[[SetData]], do
42095-
1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, then
42099+
1. If _e_ is not ~empty~ and _e_ is _value_, then
4209642100
1. Return _S_.
42097-
1. If _value_ is *-0*<sub>𝔽</sub>, set _value_ to *+0*<sub>𝔽</sub>.
4209842101
1. Append _value_ to _S_.[[SetData]].
4209942102
1. Return _S_.
4210042103
</emu-alg>
@@ -42126,8 +42129,9 @@ <h1>Set.prototype.delete ( _value_ )</h1>
4212642129
<emu-alg>
4212742130
1. Let _S_ be the *this* value.
4212842131
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
42132+
1. Set _value_ to CanonicalizeKeyedCollectionKey(_value_).
4212942133
1. For each element _e_ of _S_.[[SetData]], do
42130-
1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, then
42134+
1. If _e_ is not ~empty~ and _e_ is _value_, then
4213142135
1. Replace the element of _S_.[[SetData]] whose value is _e_ with an element whose value is ~empty~.
4213242136
1. Return *true*.
4213342137
1. Return *false*.
@@ -42184,8 +42188,9 @@ <h1>Set.prototype.has ( _value_ )</h1>
4218442188
<emu-alg>
4218542189
1. Let _S_ be the *this* value.
4218642190
1. Perform ? RequireInternalSlot(_S_, [[SetData]]).
42191+
1. Set _value_ to CanonicalizeKeyedCollectionKey(_value_).
4218742192
1. For each element _e_ of _S_.[[SetData]], do
42188-
1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, return *true*.
42193+
1. If _e_ is not ~empty~ and _e_ is _value_, return *true*.
4218942194
1. Return *false*.
4219042195
</emu-alg>
4219142196
</emu-clause>
@@ -42574,6 +42579,24 @@ <h1>Properties of WeakSet Instances</h1>
4257442579
<p>WeakSet instances are ordinary objects that inherit properties from the WeakSet prototype. WeakSet instances also have a [[WeakSetData]] internal slot.</p>
4257542580
</emu-clause>
4257642581
</emu-clause>
42582+
42583+
<emu-clause id="sec-abstract-operations-for-keyed-collections">
42584+
<h1>Abstract Operations for Keyed Collections</h1>
42585+
42586+
<emu-clause id="sec-canonicalizekeyedcollectionkey" type="abstract operation">
42587+
<h1>
42588+
CanonicalizeKeyedCollectionKey (
42589+
_key_: an ECMAScript language value,
42590+
): an ECMAScript language value
42591+
</h1>
42592+
<dl class="header">
42593+
</dl>
42594+
<emu-alg>
42595+
1. If _key_ is *-0*<sub>𝔽</sub>, return *+0*<sub>𝔽</sub>.
42596+
1. Return _key_.
42597+
</emu-alg>
42598+
</emu-clause>
42599+
</emu-clause>
4257742600
</emu-clause>
4257842601

4257942602
<emu-clause id="sec-structured-data">

0 commit comments

Comments
 (0)