Skip to content

Commit fe9abd4

Browse files
authored
Editorial: Split TypedArray [[DefineOwnProperty]] into distinct branches by mutability (#32)
1 parent e858846 commit fe9abd4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

spec.emu

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,16 @@ 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*.
102+
1. <ins>If IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, then</ins>
103+
1. <ins>Let _current_ be ! <emu-meta suppress-effects="user-code">_O_.[[GetOwnProperty]](_P_)</emu-meta>.</ins>
104+
1. <ins>Assert: _current_.[[Configurable]] and _current_.[[Writable]] are both *false*.</ins>
105+
1. <ins>NOTE: Attempting to redefine an immutable value always fails, even if the new value would be cast to the current value.</ins>
106+
1. <ins>Return ValidateAndApplyPropertyDescriptor(_O_, _P_, *false*, _Desc_, _current_).</ins>
107+
1. If _Desc_ has a [[Configurable]] field and _Desc_.[[Configurable]] is *false*, return *false*.
105108
1. If _Desc_ has an [[Enumerable]] field and _Desc_.[[Enumerable]] is *false*, return *false*.
106109
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>
110-
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>
110+
1. If _Desc_ has a [[Writable]] field and _Desc_.[[Writable]] is *false*, return *false*.
111+
1. If _Desc_ has a [[Value]] field, perform ? TypedArraySetElement(_O_, _numericIndex_, _Desc_.[[Value]]).
113112
1. Return *true*.
114113
1. Return ! OrdinaryDefineOwnProperty(_O_, _P_, _Desc_).
115114
</emu-alg>

0 commit comments

Comments
 (0)