Skip to content

Commit

Permalink
Normative: Use Set in %TypedArray%.prototype.set (#2646)
Browse files Browse the repository at this point in the history
  • Loading branch information
syg authored and ljharb committed Apr 11, 2022
1 parent 184e4ae commit 4d570c4
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -39118,25 +39118,17 @@ <h1>
1. Let _targetBuffer_ be _target_.[[ViewedArrayBuffer]].
1. If IsDetachedBuffer(_targetBuffer_) is *true*, throw a *TypeError* exception.
1. Let _targetLength_ be _target_.[[ArrayLength]].
1. Let _targetElementSize_ be TypedArrayElementSize(_target_).
1. Let _targetType_ be TypedArrayElementType(_target_).
1. Let _targetByteOffset_ be _target_.[[ByteOffset]].
1. Let _src_ be ? ToObject(_source_).
1. Let _srcLength_ be ? LengthOfArrayLike(_src_).
1. If _targetOffset_ is +&infin;, throw a *RangeError* exception.
1. If _srcLength_ + _targetOffset_ &gt; _targetLength_, throw a *RangeError* exception.
1. Let _targetByteIndex_ be _targetOffset_ &times; _targetElementSize_ + _targetByteOffset_.
1. Let _k_ be 0.
1. Let _limit_ be _targetByteIndex_ + _targetElementSize_ &times; _srcLength_.
1. Repeat, while _targetByteIndex_ &lt; _limit_,
1. Repeat, while _k_ &lt; _srcLength_,
1. Let _Pk_ be ! ToString(𝔽(_k_)).
1. Let _value_ be ? Get(_src_, _Pk_).
1. If _target_.[[ContentType]] is ~BigInt~, set _value_ to ? ToBigInt(_value_).
1. Otherwise, set _value_ to ? ToNumber(_value_).
1. If IsDetachedBuffer(_targetBuffer_) is *true*, throw a *TypeError* exception.
1. Perform SetValueInBuffer(_targetBuffer_, _targetByteIndex_, _targetType_, _value_, *true*, ~Unordered~).
1. Let _targetIndex_ be 𝔽(_targetOffset_ + _k_).
1. Perform ? IntegerIndexedElementSet(_target_, _targetIndex_, _value_).
1. Set _k_ to _k_ + 1.
1. Set _targetByteIndex_ to _targetByteIndex_ + _targetElementSize_.
1. Return ~unused~.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit 4d570c4

Please sign in to comment.