Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 94cd6e3

Browse files
nicolo-ribaudoljharbacutmore
authored
Expand R&T support across methods that accept objects and arrays (#264)
Co-authored-by: Jordan Harband <ljharb@gmail.com> Co-authored-by: Ashley Claymore <acutmore@users.noreply.github.com>
1 parent 367f9f7 commit 94cd6e3

File tree

5 files changed

+730
-8
lines changed

5 files changed

+730
-8
lines changed

spec/abstract-operations.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,19 +1025,16 @@ <h1>
10251025
</emu-alg>
10261026
</emu-clause>
10271027

1028-
<emu-clause id="sec-isconcatspreadable" type="abstract operation">
1028+
<emu-clause id="sec-isarrayortuple" type="abstract operation">
10291029
<h1>
1030-
IsConcatSpreadable (
1031-
_O_: unknown,
1032-
): either a normal completion containing a Boolean or a throw completion
1030+
IsArrayOrTuple (
1031+
_O_: an ECMAScript language value,
1032+
)
10331033
</h1>
10341034
<dl class="header">
10351035
</dl>
10361036
<emu-alg>
1037-
1. If Type(_O_) is not Object or Tuple, return *false*.
1038-
1. Let _spreadable_ be ? Get<ins>V</ins>(_O_, @@isConcatSpreadable).
1039-
1. If _spreadable_ is not *undefined*, return ToBoolean(_spreadable_).
1040-
1. <ins>If IsTuple(_O_), return *true*.</ins>
1037+
1. If IsTuple(_O_), return *true*.
10411038
1. Return ? IsArray(_O_).
10421039
</emu-alg>
10431040
</emu-clause>

spec/expression.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,36 @@ <h1>Runtime Semantics: Evaluation</h1>
323323
</emu-clause>
324324
</emu-clause>
325325
</emu-clause>
326+
327+
<emu-clause number="10" id="sec-relational-operators">
328+
<h1>Relational Operators</h1>
329+
<emu-clause id="sec-relational-operators-runtime-semantics-evaluation">
330+
<h1>Runtime Semantics: Evaluation</h1>
331+
332+
<emu-grammar>RelationalExpression : RelationalExpression `in` ShiftExpression</emu-grammar>
333+
<emu-alg>
334+
1. Let _lref_ be ? Evaluation of |RelationalExpression|.
335+
1. Let _lval_ be ? GetValue(_lref_).
336+
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
337+
1. Let _rval_ be ? GetValue(_rref_).
338+
1. <ins>If Type(_rval_) is Record, set _rval_ to ! ToObject(_rval_).</ins>
339+
1. <ins>If Type(_rval_) is Tuple, set _rval_ to ! ToObject(_rval_).</ins>
340+
1. If Type(_rval_) is not Object, throw a *TypeError* exception.
341+
1. Return ? HasProperty(_rval_, ? ToPropertyKey(_lval_)).
342+
</emu-alg>
343+
<emu-grammar>RelationalExpression : PrivateIdentifier `in` ShiftExpression</emu-grammar>
344+
<emu-alg>
345+
1. Let _privateIdentifier_ be the StringValue of |PrivateIdentifier|.
346+
1. Let _rref_ be ? Evaluation of |ShiftExpression|.
347+
1. Let _rval_ be ? GetValue(_rref_).
348+
1. <ins>If Type(_rval_) is Record, return *false*.</ins>
349+
1. <ins>If Type(_rval_) is Tuple, return *false*.</ins>
350+
1. If Type(_rval_) is not Object, throw a *TypeError* exception.
351+
1. Let _privateEnv_ be the running execution context's PrivateEnvironment.
352+
1. Let _privateName_ be ResolvePrivateIdentifier(_privateEnv_, _privateIdentifier_).
353+
1. If PrivateElementFind(_rval_, _privateName_) is not ~empty~, return *true*.
354+
1. Return *false*.
355+
</emu-alg>
356+
</emu-clause>
357+
</emu-clause>
326358
</emu-clause>

spec/immutable-data-structures.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ <h1>Tuple.prototype.concat ( ..._args_ )</h1>
269269
1. Remove the first element from _items_ and let _E_ be the value of the element.
270270
1. Let _spreadable_ be ? IsConcatSpreadable(_E_).
271271
1. If _spreadable_ is *true*, then
272+
1. Set _E_ to ! ToObject(_E_).
272273
1. Let _k_ be 0.
273274
1. Let _len_ be ? LengthOfArrayLike(_E_).
274275
1. If _n_ + _len_ &gt; 2<sup>53</sup> - 1, throw a *TypeError* exception.

0 commit comments

Comments
 (0)