Skip to content

Commit

Permalink
Editorial: Consolidate static bounds checking in IsValidIntegerIndex …
Browse files Browse the repository at this point in the history
…and StringGetOwnProperty

Index Numbers with negative sign bit are in the same "not applicable" category as non-integers.
  • Loading branch information
gibson042 committed Jan 12, 2025
1 parent fd575b6 commit 1265ed6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -14432,11 +14432,11 @@ <h1>
1. Let _index_ be CanonicalNumericIndexString(_P_).
1. If _index_ is *undefined*, return *undefined*.
1. If _index_ is not an integral Number, return *undefined*.
1. If _index_ is *-0*<sub>𝔽</sub>, return *undefined*.
1. If _index_ is *-0*<sub>𝔽</sub> or _index_ &lt; *-0*<sub>𝔽</sub>, return *undefined*.
1. Let _str_ be _S_.[[StringData]].
1. Assert: _str_ is a String.
1. Let _len_ be the length of _str_.
1. If ℝ(_index_) &lt; 0 or _len_ ≤ ℝ(_index_), return *undefined*.
1. If _len_ ≤ ℝ(_index_), return *undefined*.
1. Let _resultStr_ be the substring of _str_ from ℝ(_index_) to ℝ(_index_) + 1.
1. Return the PropertyDescriptor { [[Value]]: _resultStr_, [[Writable]]: *false*, [[Enumerable]]: *true*, [[Configurable]]: *false* }.
</emu-alg>
Expand Down Expand Up @@ -15057,12 +15057,12 @@ <h1>
<emu-alg>
1. If IsDetachedBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, return *false*.
1. If _index_ is not an integral Number, return *false*.
1. If _index_ is *-0*<sub>𝔽</sub>, return *false*.
1. If _index_ is *-0*<sub>𝔽</sub> or _index_ &lt; *-0*<sub>𝔽</sub>, return *false*.
1. Let _taRecord_ be MakeTypedArrayWithBufferWitnessRecord(_O_, ~unordered~).
1. NOTE: Bounds checking is not a synchronizing operation when _O_'s backing buffer is a growable SharedArrayBuffer.
1. If IsTypedArrayOutOfBounds(_taRecord_) is *true*, return *false*.
1. Let _length_ be TypedArrayLength(_taRecord_).
1. If ℝ(_index_) &lt; 0 or ℝ(_index_) ≥ _length_, return *false*.
1. If ℝ(_index_) ≥ _length_, return *false*.
1. Return *true*.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit 1265ed6

Please sign in to comment.