From 30257dd22f2e7ef1832b4cc1f5acb19f1e02e96b Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Thu, 30 May 2024 16:56:10 -0700 Subject: [PATCH] Editorial: introduce CanonicalizeKeyedCollectionKey (#3337) --- spec.html | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/spec.html b/spec.html index 7f233fd669..10b2af570b 100644 --- a/spec.html +++ b/spec.html @@ -6811,7 +6811,7 @@

1. IfAbruptCloseIterator(_key_, _iteratorRecord_). 1. Else, 1. Assert: _keyCoercion_ is ~zero~. - 1. If _key_ is *-0*𝔽, set _key_ to *+0*𝔽. + 1. Set _key_ to CanonicalizeKeyedCollectionKey(_key_). 1. Perform AddValueToKeyedGroup(_groups_, _key_, _value_). 1. Set _k_ to _k_ + 1. @@ -41809,8 +41809,9 @@

Map.prototype.delete ( _key_ )

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 SameValueZero(_p_.[[Key]], _key_) is *true*, then + 1. If _p_.[[Key]] is not ~empty~ and _p_.[[Key]] is _key_, then 1. Set _p_.[[Key]] to ~empty~. 1. Set _p_.[[Value]] to ~empty~. 1. Return *true*. @@ -41863,8 +41864,9 @@

Map.prototype.get ( _key_ )

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 SameValueZero(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]]. + 1. If _p_.[[Key]] is not ~empty~ and _p_.[[Key]] is _key_, return _p_.[[Value]]. 1. Return *undefined*. @@ -41875,8 +41877,9 @@

Map.prototype.has ( _key_ )

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 SameValueZero(_p_.[[Key]], _key_) is *true*, return *true*. + 1. If _p_.[[Key]] is not ~empty~ and _p_.[[Key]] is _key_, return *true*. 1. Return *false*. @@ -41896,11 +41899,11 @@

Map.prototype.set ( _key_, _value_ )

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 SameValueZero(_p_.[[Key]], _key_) is *true*, then + 1. If _p_.[[Key]] is not ~empty~ and _p_.[[Key]] is _key_, then 1. Set _p_.[[Value]] to _value_. 1. Return _M_. - 1. If _key_ is *-0*𝔽, set _key_ to *+0*𝔽. 1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }. 1. Append _p_ to _M_.[[MapData]]. 1. Return _M_. @@ -42091,10 +42094,10 @@

Set.prototype.add ( _value_ )

1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). + 1. Set _value_ to CanonicalizeKeyedCollectionKey(_value_). 1. For each element _e_ of _S_.[[SetData]], do - 1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, then + 1. If _e_ is not ~empty~ and _e_ is _value_, then 1. Return _S_. - 1. If _value_ is *-0*𝔽, set _value_ to *+0*𝔽. 1. Append _value_ to _S_.[[SetData]]. 1. Return _S_. @@ -42126,8 +42129,9 @@

Set.prototype.delete ( _value_ )

1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). + 1. Set _value_ to CanonicalizeKeyedCollectionKey(_value_). 1. For each element _e_ of _S_.[[SetData]], do - 1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, then + 1. If _e_ is not ~empty~ and _e_ is _value_, then 1. Replace the element of _S_.[[SetData]] whose value is _e_ with an element whose value is ~empty~. 1. Return *true*. 1. Return *false*. @@ -42184,8 +42188,9 @@

Set.prototype.has ( _value_ )

1. Let _S_ be the *this* value. 1. Perform ? RequireInternalSlot(_S_, [[SetData]]). + 1. Set _value_ to CanonicalizeKeyedCollectionKey(_value_). 1. For each element _e_ of _S_.[[SetData]], do - 1. If _e_ is not ~empty~ and SameValueZero(_e_, _value_) is *true*, return *true*. + 1. If _e_ is not ~empty~ and _e_ is _value_, return *true*. 1. Return *false*. @@ -42574,6 +42579,24 @@

Properties of WeakSet Instances

WeakSet instances are ordinary objects that inherit properties from the WeakSet prototype. WeakSet instances also have a [[WeakSetData]] internal slot.

+ + +

Abstract Operations for Keyed Collections

+ + +

+ CanonicalizeKeyedCollectionKey ( + _key_: an ECMAScript language value, + ): an ECMAScript language value +

+
+
+ + 1. If _key_ is *-0*𝔽, return *+0*𝔽. + 1. Return _key_. + +
+