Skip to content

Commit

Permalink
Expand R&T support across methods that accept objects and arrays (#264)
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Co-authored-by: Ashley Claymore <acutmore@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 11, 2022
1 parent 367f9f7 commit 94cd6e3
Show file tree
Hide file tree
Showing 5 changed files with 730 additions and 8 deletions.
13 changes: 5 additions & 8 deletions spec/abstract-operations.html
Original file line number Diff line number Diff line change
Expand Up @@ -1025,19 +1025,16 @@ <h1>
</emu-alg>
</emu-clause>

<emu-clause id="sec-isconcatspreadable" type="abstract operation">
<emu-clause id="sec-isarrayortuple" type="abstract operation">
<h1>
IsConcatSpreadable (
_O_: unknown,
): either a normal completion containing a Boolean or a throw completion
IsArrayOrTuple (
_O_: an ECMAScript language value,
)
</h1>
<dl class="header">
</dl>
<emu-alg>
1. If Type(_O_) is not Object or Tuple, return *false*.
1. Let _spreadable_ be ? Get<ins>V</ins>(_O_, @@isConcatSpreadable).
1. If _spreadable_ is not *undefined*, return ToBoolean(_spreadable_).
1. <ins>If IsTuple(_O_), return *true*.</ins>
1. If IsTuple(_O_), return *true*.
1. Return ? IsArray(_O_).
</emu-alg>
</emu-clause>
Expand Down
32 changes: 32 additions & 0 deletions spec/expression.html
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,36 @@ <h1>Runtime Semantics: Evaluation</h1>
</emu-clause>
</emu-clause>
</emu-clause>

<emu-clause number="10" id="sec-relational-operators">
<h1>Relational Operators</h1>
<emu-clause id="sec-relational-operators-runtime-semantics-evaluation">
<h1>Runtime Semantics: Evaluation</h1>

<emu-grammar>RelationalExpression : RelationalExpression `in` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
1. Let _lval_ be ? GetValue(_lref_).
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. <ins>If Type(_rval_) is Record, set _rval_ to ! ToObject(_rval_).</ins>
1. <ins>If Type(_rval_) is Tuple, set _rval_ to ! ToObject(_rval_).</ins>
1. If Type(_rval_) is not Object, throw a *TypeError* exception.
1. Return ? HasProperty(_rval_, ? ToPropertyKey(_lval_)).
</emu-alg>
<emu-grammar>RelationalExpression : PrivateIdentifier `in` ShiftExpression</emu-grammar>
<emu-alg>
1. Let _privateIdentifier_ be the StringValue of |PrivateIdentifier|.
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
1. Let _rval_ be ? GetValue(_rref_).
1. <ins>If Type(_rval_) is Record, return *false*.</ins>
1. <ins>If Type(_rval_) is Tuple, return *false*.</ins>
1. If Type(_rval_) is not Object, throw a *TypeError* exception.
1. Let _privateEnv_ be the running execution context's PrivateEnvironment.
1. Let _privateName_ be ResolvePrivateIdentifier(_privateEnv_, _privateIdentifier_).
1. If PrivateElementFind(_rval_, _privateName_) is not ~empty~, return *true*.
1. Return *false*.
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
1 change: 1 addition & 0 deletions spec/immutable-data-structures.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ <h1>Tuple.prototype.concat ( ..._args_ )</h1>
1. Remove the first element from _items_ and let _E_ be the value of the element.
1. Let _spreadable_ be ? IsConcatSpreadable(_E_).
1. If _spreadable_ is *true*, then
1. Set _E_ to ! ToObject(_E_).
1. Let _k_ be 0.
1. Let _len_ be ? LengthOfArrayLike(_E_).
1. If _n_ + _len_ &gt; 2<sup>53</sup> - 1, throw a *TypeError* exception.
Expand Down
Loading

0 comments on commit 94cd6e3

Please sign in to comment.