Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
rewrite funky setter and abstract as an AO
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed Oct 17, 2023
1 parent 7d48c43 commit d30ae2b
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,30 @@ <h1>Well-Known Intrinsic Objects</h1>
<emu-clause id="sec-abstract-operations">
<h1>Abstract Operations</h1>

<emu-clause id="sec-SetterThatIgnoresPrototypeProperties" type="abstract operation">
<h1>
SetterThatIgnoresPrototypeProperties(
_home_: an Object,
_p_: a property key,
_v_: an ECMAScript language value
): either a normal completion containing ~unused~ or a throw completion
</h1>
<dl class="header">
</dl>
<emu-alg>
1. Let _O_ be ? RequireObjectCoercible(*this* value).
1. If _O_ is _home_, then
1. NOTE: throwing here emulates assignment to a non-writable data property on the _home_ object in strict mode code
1. Throw a *TypeError* exception.
1. Let _desc_ be ? _O_.[[GetOwnProperty]](_p_).
1. If _desc_ is *undefined*, then
1. Perform ? CreateDataPropertyOrThrow(_O_, _p_, _v_).
1. Else,
1. Perform ? Set(_O_, _p_, _v_, *true*).
1. Return ~unused~.
</emu-alg>
</emu-clause>

<emu-clause id="sec-operations-on-iterator-objects">
<h1>Operations on Iterator Objects</h1>

Expand Down Expand Up @@ -303,14 +327,7 @@ <h1>get Iterator.prototype.constructor</h1>
<h1>set Iterator.prototype.constructor</h1>
<p>The value of the [[Set]] attribute is a built-in function that takes an argument _v_. It performs the following steps when called:</p>
<emu-alg>
1. Let _O_ be ? RequireObjectCoercible(*this* value).
1. If _O_ is %Iterator.prototype%, then
1. Throw a *TypeError* exception.
1. Let _desc_ be ? _O_.[[GetOwnProperty]](*"constructor"*).
1. If IsDataDescriptor(_desc_) is *true* and _desc_.[[Writable]] is *false*, then
1. Throw a *TypeError* exception.
1. Let _newDesc_ be the PropertyDescriptor { [[Value]]: _v_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
1. Perform ? _O_.[[DefineOwnProperty]](*"constructor"*, _newDesc_).
1. Perform ? SetterThatIgnoresPrototypeProperties(%Iterator.prototype%, *"constructor"*, _v_)
1. Return *undefined*.
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -605,14 +622,7 @@ <h1>get Iterator.prototype [ @@toStringTag ]</h1>
<h1>set Iterator.prototype [ @@toStringTag ]</h1>
<p>The value of the [[Set]] attribute is a built-in function that takes an argument _v_. It performs the following steps when called:</p>
<emu-alg>
1. Let _O_ be ? RequireObjectCoercible(*this* value).
1. If _O_ is %Iterator.prototype%, then
1. Throw a *TypeError* exception.
1. Let _desc_ be ? _O_.[[GetOwnProperty]](@@toStringTag).
1. If IsDataDescriptor(_desc_) is *true* and _desc_.[[Writable]] is *false*, then
1. Throw a *TypeError* exception.
1. Let _newDesc_ be the PropertyDescriptor { [[Value]]: _v_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
1. Perform ? _O_.[[DefineOwnProperty]](@@toStringTag, _newDesc_).
1. Perform ? SetterThatIgnoresPrototypeProperties(%Iterator.prototype%, %Symbol.toStringTag%, _v_)
1. Return *undefined*.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit d30ae2b

Please sign in to comment.