Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Normative: bugfix: do not count ~empty~ in set sizes #105

Merged
merged 1 commit into from
Feb 6, 2024
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
33 changes: 24 additions & 9 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ <h1>Set.prototype.intersection ( _other_ )</h1>
1. Perform ? RequireInternalSlot(_O_, [[SetData]]).
1. Let _otherRec_ be ? GetSetRecord(_other_).
1. Let _resultSetData_ be a new empty List.
1. Let _thisSize_ be the number of elements in _O_.[[SetData]].
1. If _thisSize_ ≤ _otherRec_.[[Size]], then
1. If SetDataSize(_O_.[[SetData]]) ≤ _otherRec_.[[Size]], then
1. Let _thisSize_ be the number of elements in _O_.[[SetData]].
1. Let _index_ be 0.
1. Repeat, while _index_ &lt; _thisSize_,
1. Let _e_ be _O_.[[SetData]][_index_].
Expand Down Expand Up @@ -80,8 +80,8 @@ <h1>Set.prototype.difference ( _other_ )</h1>
1. Perform ? RequireInternalSlot(_O_, [[SetData]]).
1. Let _otherRec_ be ? GetSetRecord(_other_).
1. Let _resultSetData_ be a copy of _O_.[[SetData]].
1. Let _thisSize_ be the number of elements in _O_.[[SetData]].
1. If _thisSize_ ≤ _otherRec_.[[Size]], then
1. If SetDataSize(_O_.[[SetData]]) ≤ _otherRec_.[[Size]], then
1. Let _thisSize_ be the number of elements in _O_.[[SetData]].
1. Let _index_ be 0.
1. Repeat, while _index_ &lt; _thisSize_,
1. Let _e_ be _resultSetData_[_index_].
Expand Down Expand Up @@ -139,8 +139,8 @@ <h1>Set.prototype.isSubsetOf ( _other_ )</h1>
1. Let _O_ be the *this* value.
1. Perform ? RequireInternalSlot(_O_, [[SetData]]).
1. Let _otherRec_ be ? GetSetRecord(_other_).
1. If SetDataSize(_O_.[[SetData]]) > _otherRec_.[[Size]], return *false*.
1. Let _thisSize_ be the number of elements in _O_.[[SetData]].
1. If _thisSize_ > _otherRec_.[[Size]], return *false*.
1. Let _index_ be 0.
1. Repeat, while _index_ &lt; _thisSize_,
1. Let _e_ be _O_.[[SetData]][_index_].
Expand All @@ -161,8 +161,7 @@ <h1>Set.prototype.isSupersetOf ( _other_ )</h1>
1. Let _O_ be the *this* value.
1. Perform ? RequireInternalSlot(_O_, [[SetData]]).
1. Let _otherRec_ be ? GetSetRecord(_other_).
1. Let _thisSize_ be the number of elements in _O_.[[SetData]].
1. If _thisSize_ &lt; _otherRec_.[[Size]], return *false*.
1. If SetDataSize(_O_.[[SetData]]) &lt; _otherRec_.[[Size]], return *false*.
1. Let _keysIter_ be ? GetIteratorFromMethod(_otherRec_.[[Set]], _otherRec_.[[Keys]]).
1. Let _next_ be *true*.
1. Repeat, while _next_ is not *false*,
Expand All @@ -183,8 +182,8 @@ <h1>Set.prototype.isDisjointFrom ( _other_ )</h1>
1. Let _O_ be the *this* value.
1. Perform ? RequireInternalSlot(_O_, [[SetData]]).
1. Let _otherRec_ be ? GetSetRecord(_other_).
1. Let _thisSize_ be the number of elements in _O_.[[SetData]].
1. If _thisSize_ ≤ _otherRec_.[[Size]], then
1. If SetDataSize(_O_.[[SetData]]) ≤ _otherRec_.[[Size]], then
1. Let _thisSize_ be the number of elements in _O_.[[SetData]].
1. Let _index_ be 0.
1. Repeat, while _index_ &lt; _thisSize_,
1. Let _e_ be _O_.[[SetData]][_index_].
Expand Down Expand Up @@ -312,3 +311,19 @@ <h1>
1. Return *false*.
</emu-alg>
</emu-clause>

<emu-clause id="sec-setdatasize" type="abstract operation">
<h1>
SetDataSize (
_setData_: a List of either ~empty~ or ECMAScript language values,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"a List" is sufficient here, but this is also fine.

): a non-negative integer
</h1>
<dl class="header">
</dl>
<emu-alg>
1. Let _count_ be 0.
1. For each element _e_ of _setData_, do
1. If _e_ is not ~empty~, set _count_ to _count_ + 1.
1. Return _count_.
</emu-alg>
</emu-clause>
Loading