From 4d570c4773eb219b347b58d19a80b35f6907f18e Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Mon, 11 Apr 2022 15:10:04 -0700 Subject: [PATCH] Normative: Use Set in %TypedArray%.prototype.set (#2646) --- spec.html | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/spec.html b/spec.html index e3a8cc685c..dafcc675cd 100644 --- a/spec.html +++ b/spec.html @@ -39118,25 +39118,17 @@

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 +∞, throw a *RangeError* exception. 1. If _srcLength_ + _targetOffset_ > _targetLength_, throw a *RangeError* exception. - 1. Let _targetByteIndex_ be _targetOffset_ × _targetElementSize_ + _targetByteOffset_. 1. Let _k_ be 0. - 1. Let _limit_ be _targetByteIndex_ + _targetElementSize_ × _srcLength_. - 1. Repeat, while _targetByteIndex_ < _limit_, + 1. Repeat, while _k_ < _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~.