Skip to content

Commit 342bae0

Browse files
committed
Editorial: Split TypedArray [[DefineOwnProperty]] into distinct branches by mutability
1 parent 39c2484 commit 342bae0

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

spec.emu

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,21 @@ contributors: Mark S. Miller, Richard Gibson
9999
1. Let _numericIndex_ be CanonicalNumericIndexString(_P_).
100100
1. If _numericIndex_ is not *undefined*, then
101101
1. If IsValidIntegerIndex(_O_, _numericIndex_) is *false*, return *false*.
102-
1. <ins>Let _mutable_ be *true*.</ins>
103-
1. <ins>If IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, set _mutable_ to *false*.</ins>
104-
1. If _Desc_ has a [[Configurable]] field and _Desc_.[[Configurable]] is <del>*false*</del> <ins>not _mutable_</ins>, return *false*.
105-
1. If _Desc_ has an [[Enumerable]] field and _Desc_.[[Enumerable]] is *false*, return *false*.
106-
1. If IsAccessorDescriptor(_Desc_) is *true*, return *false*.
107-
1. If _Desc_ has a [[Writable]] field and _Desc_.[[Writable]] is <del>*false*</del> <ins>not _mutable_</ins>, return *false*.
108-
1. <del>If _Desc_ has a [[Value]] field, perform ? TypedArraySetElement(_O_, _numericIndex_, _Desc_.[[Value]]).</del>
109-
1. <ins>If _Desc_ has a [[Value]] field, then</ins>
102+
1. <ins>If _Desc_ has an [[Enumerable]] field and _Desc_.[[Enumerable]] is *false*, return *false*.</ins>
103+
1. <ins>If IsAccessorDescriptor(_Desc_) is *true*, return *false*.</ins>
104+
1. <ins>If IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *false*, then</ins>
105+
1. If _Desc_ has a [[Configurable]] field and _Desc_.[[Configurable]] is *false*, return *false*.
106+
1. <del>If _Desc_ has an [[Enumerable]] field and _Desc_.[[Enumerable]] is *false*, return *false*.</del>
107+
1. <del>If IsAccessorDescriptor(_Desc_) is *true*, return *false*.</del>
108+
1. If _Desc_ has a [[Writable]] field and _Desc_.[[Writable]] is *false*, return *false*.
109+
1. If _Desc_ has a [[Value]] field, perform ? TypedArraySetElement(_O_, _numericIndex_, _Desc_.[[Value]]).
110+
1. Return *true*.
111+
1. <ins>Else,</ins>
112+
1. <ins>If _Desc_ has a [[Configurable]] field and _Desc_.[[Configurable]] is *true*, return *false*.</ins>
113+
1. <ins>If _Desc_ has a [[Writable]] field and _Desc_.[[Writable]] is *true*, return *false*.</ins>
110114
1. <ins>NOTE: Attempting to redefine an immutable value always fails, even if the new value would be cast to the current value.</ins>
111-
1. <ins>If _mutable_ is *false* and SameValue(_Desc_.[[Value]], TypedArrayGetElement(_O_, _numericIndex_)) is *false*, return *false*.</ins>
112-
1. <ins>If _mutable_ is *true*, perform ? TypedArraySetElement(_O_, _numericIndex_, _Desc_.[[Value]]).</ins>
113-
1. Return *true*.
115+
1. <ins>If _Desc_ has a [[Value]] field and SameValue(_Desc_.[[Value]], TypedArrayGetElement(_O_, _numericIndex_)) is *false*, return *false*.</ins>
116+
1. <ins>Return *true*.</ins>
114117
1. Return ! OrdinaryDefineOwnProperty(_O_, _P_, _Desc_).
115118
</emu-alg>
116119
</emu-clause>

0 commit comments

Comments
 (0)