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

Update spec #36

Merged
merged 5 commits into from
Dec 19, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h1><span class="secnum">6</span>Set.prototype.isSubsetOf(<var>iterable</var>)</
<h1><span class="secnum">7</span>Set.prototype.isSupersetOf(<var>iterable</var>)</h1>
<emu-import href="./set-prototype-is-superset-of.html"><p>When the <code>isSupersetOf</code> method is called with argument <var>iterable</var>, the following steps are taken:</p>

<emu-alg><ol><li>Let <var>set</var> be the <emu-val>this</emu-val> value.</li><li>If <emu-xref aoid="Type" id="_ref_54"><a href="https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values">Type</a></emu-xref>(<var>set</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>set</var> does not have a [[SetData]] internal slot, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>hasCheck</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_55"><a href="https://tc39.github.io/ecma262/#sec-get-o-p">Get</a></emu-xref>(<var>set</var>, "has").</li><li>If <emu-xref aoid="IsCallable" id="_ref_56"><a href="https://tc39.github.io/ecma262/#sec-iscallable">IsCallable</a></emu-xref>(<var>hasCheck</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>iter</var> be ?&nbsp;<emu-xref aoid="GetIterator" id="_ref_57"><a href="https://tc39.github.io/ecma262/#sec-getiterator">GetIterator</a></emu-xref>(<var>iterable</var>).</li><li>If <var>iter</var> is undefined, throw a <emu-val>TypeError</emu-val> exception.</li><li>Repeat,<ol><li>Let <var>next</var> be <emu-xref aoid="IteratorStep" id="_ref_58"><a href="https://tc39.github.io/ecma262/#sec-iteratorstep">IteratorStep</a></emu-xref>(<var>iter</var>).</li><li>If <var>next</var> is <emu-val>false</emu-val>, return <emu-val>true</emu-val>.</li><li>Let <var>nextValue</var> be ?&nbsp;<emu-xref aoid="IteratorValue" id="_ref_59"><a href="https://tc39.github.io/ecma262/#sec-iteratorvalue">IteratorValue</a></emu-xref>(<var>next</var>).</li><li>Let <var>has</var> be ?&nbsp;<emu-xref aoid="Call" id="_ref_60"><a href="https://tc39.github.io/ecma262/#sec-call">Call</a></emu-xref>(<var>hasCheck</var>, <var>set</var>, « e »).</li><li>If <var>has</var> is an <emu-xref href="#sec-completion-record-specification-type"><a href="https://tc39.github.io/ecma262/#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return ?&nbsp;<emu-xref aoid="IteratorClose" id="_ref_61"><a href="https://tc39.github.io/ecma262/#sec-iteratorclose">IteratorClose</a></emu-xref>(<var>iter</var>, <var>has</var>).</li><li>If <var>has</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li></ol></li></ol></emu-alg>
<emu-alg><ol><li>Let <var>set</var> be the <emu-val>this</emu-val> value.</li><li>If <emu-xref aoid="Type" id="_ref_54"><a href="https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values">Type</a></emu-xref>(<var>set</var>) is not Object, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>hasCheck</var> be ?&nbsp;<emu-xref aoid="Get" id="_ref_55"><a href="https://tc39.github.io/ecma262/#sec-get-o-p">Get</a></emu-xref>(<var>set</var>, "has").</li><li>If <emu-xref aoid="IsCallable" id="_ref_56"><a href="https://tc39.github.io/ecma262/#sec-iscallable">IsCallable</a></emu-xref>(<var>hasCheck</var>) is <emu-val>false</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>iter</var> be ?&nbsp;<emu-xref aoid="GetIterator" id="_ref_57"><a href="https://tc39.github.io/ecma262/#sec-getiterator">GetIterator</a></emu-xref>(<var>iterable</var>).</li><li>If <var>iter</var> is undefined, throw a <emu-val>TypeError</emu-val> exception.</li><li>Repeat,<ol><li>Let <var>next</var> be <emu-xref aoid="IteratorStep" id="_ref_58"><a href="https://tc39.github.io/ecma262/#sec-iteratorstep">IteratorStep</a></emu-xref>(<var>iter</var>).</li><li>If <var>next</var> is <emu-val>false</emu-val>, return <emu-val>true</emu-val>.</li><li>Let <var>nextValue</var> be ?&nbsp;<emu-xref aoid="IteratorValue" id="_ref_59"><a href="https://tc39.github.io/ecma262/#sec-iteratorvalue">IteratorValue</a></emu-xref>(<var>next</var>).</li><li>Let <var>has</var> be ?&nbsp;<emu-xref aoid="Call" id="_ref_60"><a href="https://tc39.github.io/ecma262/#sec-call">Call</a></emu-xref>(<var>hasCheck</var>, <var>set</var>, « e »).</li><li>If <var>has</var> is an <emu-xref href="#sec-completion-record-specification-type"><a href="https://tc39.github.io/ecma262/#sec-completion-record-specification-type">abrupt completion</a></emu-xref>, return ?&nbsp;<emu-xref aoid="IteratorClose" id="_ref_61"><a href="https://tc39.github.io/ecma262/#sec-iteratorclose">IteratorClose</a></emu-xref>(<var>iter</var>, <var>has</var>).</li><li>If <var>has</var> is <emu-val>false</emu-val>, return <emu-val>false</emu-val>.</li></ol></li></ol></emu-alg>
</emu-import>
</emu-clause>

Expand Down
20 changes: 9 additions & 11 deletions spec/set-prototype-is-disjoint-with.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
<emu-alg>
1. Let _set_ be the *this* value.
1. If Type(_set_) is not Object, throw a *TypeError* exception.
1. If _set_ does not have a [[SetData]] internal slot, throw a *TypeError* exception.
1. Let _entries_ be the List that is _set_.[[SetData]].
1. If Type(_iterable_) is not Object, throw a *TypeError* exception.
1. If _iterable_ does not have [[SetData]] internal slot,
1. Let _otherSet_ be ? Construct(%Set%, _iterable_).
1. Else, let _otherSet_ be _iterable_.
1. Let _hasCheck_ be ? Get(_otherSet_, "has").
1. Let _hasCheck_ be ? Get(_set_, "has").
1. If IsCallable(_hasCheck_) is *false*, throw a *TypeError* exception.
1. For each _e_ that is an element of _entries_, do
1. Let _has_ be ? Call(_hasCheck_, _otherSet_, « e »)
1. Let _iter_ be ? GetIterator(_iterable_).
1. If _iter_ is undefined, throw a *TypeError* exception.
1. Repeat,
1. Let _next_ be IteratorStep(_iter_).
1. If _next_ is *false*, return *true*.
1. Let _nextValue_ be ? IteratorValue(_next_).
1. Let _has_ be ? Call(_hasCheck_, _set_, « e »).
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this is a typo, but if so:

Suggested change
1. Let _has_ be ? Call(_hasCheck_, _set_, « e »).
1. Let _has_ be ? Call(_hasCheck_, _set_, « _nextValue_ »).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

1. If _has_ is an abrupt completion, return ? IteratorClose(_iter_, _has_).
1. If _has_ is *true*, return *false*.
1. return *true*.

</emu-alg>
4 changes: 1 addition & 3 deletions spec/set-prototype-is-superset-of.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<emu-alg>
1. Let _set_ be the *this* value.
1. If Type(_set_) is not Object, throw a *TypeError* exception.
1. If _set_ does not have a [[SetData]] internal slot, throw a *TypeError* exception.
1. Let _hasCheck_ be ? Get(_set_, "has").
1. If IsCallable(_hasCheck_) is *false*, throw a *TypeError* exception.
1. Let _iter_ be ? GetIterator(_iterable_).
Expand All @@ -12,8 +11,7 @@
1. Let _next_ be IteratorStep(_iter_).
1. If _next_ is *false*, return *true*.
1. Let _nextValue_ be ? IteratorValue(_next_).
1. Let _has_ be ? Call(_hasCheck_, _set_, « e »).
1. Let _has_ be ? Call(_hasCheck_, _set_, « _nextValue_.[[Value]] »).
Copy link
Member

Choose a reason for hiding this comment

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

Is the .[[Value]] needed here? Doesn’t the ? / ReturnIfAbrupt unwrap the completion record for you?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed! I was mostly going off the Set constructor in the spec which was recently fixed too (tc39/ecma262#1310) 😄

Updated all the other methods to do the same too.

1. If _has_ is an abrupt completion, return ? IteratorClose(_iter_, _has_).
1. If _has_ is *false*, return *false*.

</emu-alg>