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

Commit 2a76ee5

Browse files
make @@toStringTag and constructor prototype properties funky accessors
1 parent 0938104 commit 2a76ee5

File tree

1 file changed

+56
-3
lines changed

1 file changed

+56
-3
lines changed

spec.html

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,35 @@ <h1>Iterator.prototype</h1>
288288

289289
<emu-clause id="sec-iteratorprototype.constructor">
290290
<h1>Iterator.prototype.constructor</h1>
291-
<p>The initial value of %Iterator.prototype%.constructor is %Iterator%.</p>
291+
<p>`Iterator.prototype.constructor` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }. The [[Get]] and [[Set]] attributes are defined as follows:</p>
292+
293+
<emu-clause id="sec-get-iteratorprototype-constructor">
294+
<h1>get Iterator.prototype.constructor</h1>
295+
<p>The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps when called:</p>
296+
<emu-alg>
297+
1. Return %Iterator%.
298+
</emu-alg>
299+
</emu-clause>
300+
301+
<emu-clause id="sec-set-iteratorprototype-constructor">
302+
<h1>set Iterator.prototype.constructor</h1>
303+
<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>
304+
<emu-alg>
305+
1. Let _O_ be ? RequireObjectCoercible(*this* value).
306+
1. If _O_ is %Iterator.prototype%, then
307+
1. Return *undefined*.
308+
1. Let _desc_ be ? _O_.[[GetOwnProperty]](*"constructor"*).
309+
1. If IsDataDescriptor(_desc_) is *true* and _desc_.[[Writable]] is *false*, then
310+
1. Return *undefined*.
311+
1. Let _newDesc_ be the PropertyDescriptor { [[Value]]: _v_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
312+
1. Perform ? _O_.[[DefineOwnProperty]](*"constructor"*, _newDesc_).
313+
1. Return *undefined*.
314+
</emu-alg>
315+
</emu-clause>
316+
317+
<emu-note>
318+
<p>Unlike the *"constructor"* property on most built-in prototypes, for web-compatibility reasons this property must be an accessor.</p>
319+
</emu-note>
292320
</emu-clause>
293321

294322
<emu-clause id="sec-iteratorprototype.map">
@@ -562,9 +590,34 @@ <h1>Iterator.prototype.find ( _predicate_ )</h1>
562590

563591
<emu-clause id="sec-iteratorprototype-@@tostringtag">
564592
<h1>Iterator.prototype [ @@toStringTag ]</h1>
565-
<p>The initial value of the @@toStringTag property is the String value "Iterator".</p>
593+
<p>`Iterator.prototype[@@toStringTag]` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }. The [[Get]] and [[Set]] attributes are defined as follows:</p>
594+
595+
<emu-clause id="sec-get-iteratorprototype-@@tostringtag">
596+
<h1>get Iterator.prototype [ @@toStringTag ]</h1>
597+
<p>The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps when called:</p>
598+
<emu-alg>
599+
1. Return *"Iterator"*.
600+
</emu-alg>
601+
</emu-clause>
602+
603+
<emu-clause id="sec-set-iteratorprototype-@@tostringtag">
604+
<h1>set Iterator.prototype [ @@toStringTag ]</h1>
605+
<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>
606+
<emu-alg>
607+
1. Let _O_ be ? RequireObjectCoercible(*this* value).
608+
1. If _O_ is %Iterator.prototype%, then
609+
1. Return *undefined*.
610+
1. Let _desc_ be ? _O_.[[GetOwnProperty]](@@toStringTag).
611+
1. If IsDataDescriptor(_desc_) is *true* and _desc_.[[Writable]] is *false*, then
612+
1. Return *undefined*.
613+
1. Let _newDesc_ be the PropertyDescriptor { [[Value]]: _v_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
614+
1. Perform ? _O_.[[DefineOwnProperty]](@@toStringTag, _newDesc_).
615+
1. Return *undefined*.
616+
</emu-alg>
617+
</emu-clause>
618+
566619
<emu-note>
567-
<p>Unlike the @@toStringTag on most built-in classes, for web-compatibility reasons this property must be writable.</p>
620+
<p>Unlike the @@toStringTag property on most built-in prototypes, for web-compatibility reasons this property must be an accessor.</p>
568621
</emu-note>
569622
</emu-clause>
570623
</emu-clause>

0 commit comments

Comments
 (0)