Skip to content

Commit 94efda2

Browse files
authored
Editorial: Fix typos (merge tc39#28)
2 parents f837afb + 9c5ba34 commit 94efda2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

spec.emu

+8-7
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ contributors: Mark S. Miller, Richard Gibson
490490
1. Assert: _count_ ≤ _byteLength_.
491491
1. Let _newBuffer_ be ? <emu-meta suppress-effects="user-code">AllocateArrayBuffer(_constructor_, _byteLength_, ~immutable~)</emu-meta>.
492492
1. Let _toBlock_ be _newBuffer_.[[ArrayBufferData]].
493-
1. Perform CopyDataBlockBytes(_toBlock_, 0, _fromBlock_, 0, _count_).
493+
1. NOTE: This is the only step that can write into the Data Block of an immutable ArrayBuffer.
494+
1. Perform CopyDataBlockBytes(_toBlock_, 0, _fromBlock_, _fromIndex_, _count_).
494495
1. Return _newBuffer_.
495496
</emu-alg>
496497
<emu-note>
@@ -529,7 +530,6 @@ contributors: Mark S. Miller, Richard Gibson
529530
1. Let _newBuffer_ be ? <emu-meta suppress-effects="user-code">AllocateArrayBuffer(%ArrayBuffer%, _newByteLength_, _newMaxByteLength_)</emu-meta>.
530531
1. <del>Let _copyLength_ be min(_newByteLength_, _arrayBuffer_.[[ArrayBufferByteLength]]).</del>
531532
1. Let _fromBlock_ be _arrayBuffer_.[[ArrayBufferData]].
532-
1. <ins>NOTE: This is the only step that can write into the Data Block of an immutable ArrayBuffer.</ins>
533533
1. Let _toBlock_ be _newBuffer_.[[ArrayBufferData]].
534534
1. Perform CopyDataBlockBytes(_toBlock_, 0, _fromBlock_, 0, _copyLength_).
535535
1. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations may implement this method as a zero-copy move or a `realloc`.
@@ -717,19 +717,20 @@ contributors: Mark S. Miller, Richard Gibson
717717
1. Let _O_ be the *this* value.
718718
1. Perform ? RequireInternalSlot(_O_, [[ArrayBufferData]]).
719719
1. If IsSharedArrayBuffer(_O_) is *true*, throw a *TypeError* exception.
720-
1. TODO: Confirm inclusion of this redundant check.
721720
1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception.
722721
1. Let _len_ be _O_.[[ArrayBufferByteLength]].
723722
1. Let _bounds_ be ? ResolveBounds(_len_, _start_, _end_).
724723
1. Let _first_ be _bounds_.[[From]].
725724
1. Let _final_ be _bounds_.[[To]].
726-
1. TODO: Confirm this strictness vs. the conventional `max(_final_ - _first_, 0)`.
727725
1. Let _newLen_ be _final_ - _first_.
726+
1. TODO: Confirm this strictness vs. `slice` (rejecting negative _newLen_ rather than clamping to 0).
728727
1. If _newLen_ &lt; 0, throw a *RangeError* exception.
729-
1. Let _copyLen_ be min(_newLen_, _len_).
730-
1. NOTE: Side-effects of the above steps may have detached or resized _O_. This algorithm proceeds only when _O_ is not detached, even if _newLen_ is 0.
728+
1. NOTE: Side-effects of the above steps may have detached or resized _O_.
731729
1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception.
732-
1. Let _newBuffer_ be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, _newLen_, _O_.[[ArrayBufferData]], _first_, _copyLen_).
730+
1. Let _fromBuf_ be _O_.[[ArrayBufferData]].
731+
1. Let _currentLen_ be _O_.[[ArrayBufferByteLength]].
732+
1. If _currentLen_ &lt; _final_, throw a *RangeError* exception.
733+
1. Let _newBuffer_ be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, _newLen_, _fromBuf_, _first_, _newLen_).
733734
1. Return _newBuffer_.
734735
</emu-alg>
735736
</emu-clause>

0 commit comments

Comments
 (0)