Skip to content

Commit

Permalink
make @@toStringTag and constructor prototype properties funky accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed Sep 18, 2023
1 parent 257f4ea commit e298671
Showing 1 changed file with 56 additions and 3 deletions.
59 changes: 56 additions & 3 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,35 @@ <h1>Iterator.prototype</h1>

<emu-clause id="sec-iteratorprototype.constructor">
<h1>Iterator.prototype.constructor</h1>
<p>The initial value of %Iterator.prototype%.constructor is %Iterator%.</p>
<p>`Iterator.prototype.constructor` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }. The [[Get]] and [[Set]] attributes are defined as follows:</p>

<emu-clause id="sec-get-iteratorprototype-constructor">
<h1>get Iterator.prototype.constructor</h1>
<p>The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps when called:</p>
<emu-alg>
1. Return %Iterator%.
</emu-alg>
</emu-clause>

<emu-clause id="sec-set-iteratorprototype-constructor">
<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. Return *undefined*.
1. Let _desc_ be ? _O_.[[GetOwnProperty]](*"constructor"*).
1. If IsDataDescriptor(_desc_) is *true* and _desc_.[[Writable]] is *false*, then
1. Return *undefined*.
1. Let _newDesc_ be the PropertyDescriptor { [[Value]]: _v_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
1. Perform ? _O_.[[DefineOwnProperty]](*"constructor"*, _newDesc_).
1. Return *undefined*.
</emu-alg>
</emu-clause>

<emu-note>
<p>Unlike the *"constructor"* property on most built-in prototypes, for web-compatibility reasons this property must be an accessor.</p>
</emu-note>
</emu-clause>

<emu-clause id="sec-iteratorprototype.map">
Expand Down Expand Up @@ -563,9 +591,34 @@ <h1>Iterator.prototype.find ( _predicate_ )</h1>

<emu-clause id="sec-iteratorprototype-@@tostringtag">
<h1>Iterator.prototype [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the String value "Iterator".</p>
<p>`Iterator.prototype[@@toStringTag]` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }. The [[Get]] and [[Set]] attributes are defined as follows:</p>

<emu-clause id="sec-get-iteratorprototype-@@tostringtag">
<h1>get Iterator.prototype [ @@toStringTag ]</h1>
<p>The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps when called:</p>
<emu-alg>
1. Return *"Iterator"*.
</emu-alg>
</emu-clause>

<emu-clause id="sec-set-iteratorprototype-@@tostringtag">
<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. Return *undefined*.
1. Let _desc_ be ? _O_.[[GetOwnProperty]](@@toStringTag).
1. If IsDataDescriptor(_desc_) is *true* and _desc_.[[Writable]] is *false*, then
1. Return *undefined*.
1. Let _newDesc_ be the PropertyDescriptor { [[Value]]: _v_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
1. Perform ? _O_.[[DefineOwnProperty]](@@toStringTag, _newDesc_).
1. Return *undefined*.
</emu-alg>
</emu-clause>

<emu-note>
<p>Unlike the @@toStringTag on most built-in classes, for web-compatibility reasons this property must be writable.</p>
<p>Unlike the @@toStringTag property on most built-in prototypes, for web-compatibility reasons this property must be an accessor.</p>
</emu-note>
</emu-clause>
</emu-clause>
Expand Down

0 comments on commit e298671

Please sign in to comment.