Skip to content

Commit

Permalink
Editorial: Add %GeneratorPrototype%/%AsyncGeneratorPrototype% well-kn…
Browse files Browse the repository at this point in the history
…own intrinsics, use instead of {,Async}Generator.prototype (#3238)

 - Use "generator function" instead of "generator" for GeneratorFunction instances
  • Loading branch information
arai-a authored and ljharb committed Feb 21, 2024
1 parent c579bc2 commit fdde1c9
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 55 deletions.
62 changes: 31 additions & 31 deletions img/figure-2.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 44 additions & 24 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -3307,7 +3307,17 @@ <h1>Well-Known Intrinsic Objects</h1>
<td>
</td>
<td>
The constructor of async iterator objects (<emu-xref href="#sec-asyncgeneratorfunction-constructor"></emu-xref>)
The constructor of async generator function objects (<emu-xref href="#sec-asyncgeneratorfunction-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%AsyncGeneratorPrototype%
</td>
<td>
</td>
<td>
The prototype of async generator objects (<emu-xref href="#sec-asyncgenerator-objects"></emu-xref>)
</td>
</tr>
<tr>
Expand Down Expand Up @@ -3535,7 +3545,17 @@ <h1>Well-Known Intrinsic Objects</h1>
<td>
</td>
<td>
The constructor of Generators (<emu-xref href="#sec-generatorfunction-constructor"></emu-xref>)
The constructor of generator function objects (<emu-xref href="#sec-generatorfunction-constructor"></emu-xref>)
</td>
</tr>
<tr>
<td>
%GeneratorPrototype%
</td>
<td>
</td>
<td>
The prototype of generator objects (<emu-xref href="#sec-generator-objects"></emu-xref>)
</td>
</tr>
<tr>
Expand Down Expand Up @@ -47336,7 +47356,7 @@ <h1>GeneratorFunction.prototype.constructor</h1>

<emu-clause id="sec-generatorfunction.prototype.prototype">
<h1>GeneratorFunction.prototype.prototype</h1>
<p>The initial value of `GeneratorFunction.prototype.prototype` is the Generator prototype object.</p>
<p>The initial value of `GeneratorFunction.prototype.prototype` is %GeneratorPrototype%.</p>
<p>This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
</emu-clause>

Expand Down Expand Up @@ -47438,7 +47458,7 @@ <h1>AsyncGeneratorFunction.prototype.constructor</h1>

<emu-clause id="sec-asyncgeneratorfunction-prototype-prototype">
<h1>AsyncGeneratorFunction.prototype.prototype</h1>
<p>The initial value of `AsyncGeneratorFunction.prototype.prototype` is the AsyncGenerator prototype object.</p>
<p>The initial value of `AsyncGeneratorFunction.prototype.prototype` is %AsyncGeneratorPrototype%.</p>
<p>This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
</emu-clause>

Expand Down Expand Up @@ -47478,12 +47498,12 @@ <h1>prototype</h1>

<emu-clause id="sec-generator-objects">
<h1>Generator Objects</h1>
<p>A Generator is an instance of a generator function and conforms to both the <i>Iterator</i> and <i>Iterable</i> interfaces.</p>
<p>Generator instances directly inherit properties from the object that is the initial value of the *"prototype"* property of the Generator function that created the instance. Generator instances indirectly inherit properties from the Generator Prototype intrinsic, %GeneratorFunction.prototype.prototype%.</p>
<p>A Generator is created by calling a generator function and conforms to both the <i>Iterator</i> and <i>Iterable</i> interfaces.</p>
<p>Generator instances directly inherit properties from the initial value of the *"prototype"* property of the generator function that created the instance. Generator instances indirectly inherit properties from %GeneratorPrototype%.</p>

<emu-clause id="sec-properties-of-generator-prototype">
<h1>Properties of the Generator Prototype Object</h1>
<p>The <dfn>Generator prototype object</dfn>:</p>
<h1>The %GeneratorPrototype% Object</h1>
<p>The <dfn>%GeneratorPrototype%</dfn> object:</p>
<ul>
<li>is <dfn>%GeneratorFunction.prototype.prototype%</dfn>.</li>
<li>is an ordinary object.</li>
Expand All @@ -47493,20 +47513,20 @@ <h1>Properties of the Generator Prototype Object</h1>
</ul>

<emu-clause id="sec-generator.prototype.constructor">
<h1>Generator.prototype.constructor</h1>
<p>The initial value of `Generator.prototype.constructor` is %GeneratorFunction.prototype%.</p>
<h1>%GeneratorPrototype%.constructor</h1>
<p>The initial value of %GeneratorPrototype%`.constructor` is %GeneratorFunction.prototype%.</p>
<p>This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
</emu-clause>

<emu-clause id="sec-generator.prototype.next">
<h1>Generator.prototype.next ( _value_ )</h1>
<h1>%GeneratorPrototype%.next ( _value_ )</h1>
<emu-alg>
1. Return ? GeneratorResume(*this* value, _value_, ~empty~).
</emu-alg>
</emu-clause>

<emu-clause id="sec-generator.prototype.return">
<h1>Generator.prototype.return ( _value_ )</h1>
<h1>%GeneratorPrototype%.return ( _value_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _g_ be the *this* value.
Expand All @@ -47516,7 +47536,7 @@ <h1>Generator.prototype.return ( _value_ )</h1>
</emu-clause>

<emu-clause id="sec-generator.prototype.throw">
<h1>Generator.prototype.throw ( _exception_ )</h1>
<h1>%GeneratorPrototype%.throw ( _exception_ )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _g_ be the *this* value.
Expand All @@ -47526,7 +47546,7 @@ <h1>Generator.prototype.throw ( _exception_ )</h1>
</emu-clause>

<emu-clause id="sec-generator.prototype-@@tostringtag">
<h1>Generator.prototype [ @@toStringTag ]</h1>
<h1>%GeneratorPrototype% [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the String value *"Generator"*.</p>
<p>This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
</emu-clause>
Expand Down Expand Up @@ -47788,13 +47808,13 @@ <h1>

<emu-clause id="sec-asyncgenerator-objects">
<h1>AsyncGenerator Objects</h1>
<p>An AsyncGenerator is an instance of an async generator function and conforms to both the AsyncIterator and AsyncIterable interfaces.</p>
<p>An AsyncGenerator is created by calling an async generator function and conforms to both the AsyncIterator and AsyncIterable interfaces.</p>

<p>AsyncGenerator instances directly inherit properties from the object that is the initial value of the *"prototype"* property of the AsyncGenerator function that created the instance. AsyncGenerator instances indirectly inherit properties from the AsyncGenerator Prototype intrinsic, %AsyncGeneratorFunction.prototype.prototype%.</p>
<p>AsyncGenerator instances directly inherit properties from the initial value of the *"prototype"* property of the async generator function that created the instance. AsyncGenerator instances indirectly inherit properties from %AsyncGeneratorPrototype%.</p>

<emu-clause id="sec-properties-of-asyncgenerator-prototype">
<h1>Properties of the AsyncGenerator Prototype Object</h1>
<p>The <dfn>AsyncGenerator prototype object</dfn>:</p>
<h1>The %AsyncGeneratorPrototype% Object</h1>
<p>The <dfn>%AsyncGeneratorPrototype%</dfn> object:</p>
<ul>
<li>is <dfn>%AsyncGeneratorFunction.prototype.prototype%</dfn>.</li>
<li>is an ordinary object.</li>
Expand All @@ -47804,13 +47824,13 @@ <h1>Properties of the AsyncGenerator Prototype Object</h1>
</ul>

<emu-clause id="sec-asyncgenerator-prototype-constructor">
<h1>AsyncGenerator.prototype.constructor</h1>
<p>The initial value of `AsyncGenerator.prototype.constructor` is %AsyncGeneratorFunction.prototype%.</p>
<h1>%AsyncGeneratorPrototype%.constructor</h1>
<p>The initial value of %AsyncGeneratorPrototype%`.constructor` is %AsyncGeneratorFunction.prototype%.</p>
<p>This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
</emu-clause>

<emu-clause id="sec-asyncgenerator-prototype-next">
<h1>AsyncGenerator.prototype.next ( _value_ )</h1>
<h1>%AsyncGeneratorPrototype%.next ( _value_ )</h1>
<emu-alg>
1. Let _generator_ be the *this* value.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
Expand All @@ -47832,7 +47852,7 @@ <h1>AsyncGenerator.prototype.next ( _value_ )</h1>
</emu-clause>

<emu-clause id="sec-asyncgenerator-prototype-return">
<h1>AsyncGenerator.prototype.return ( _value_ )</h1>
<h1>%AsyncGeneratorPrototype%.return ( _value_ )</h1>
<emu-alg>
1. Let _generator_ be the *this* value.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
Expand All @@ -47853,7 +47873,7 @@ <h1>AsyncGenerator.prototype.return ( _value_ )</h1>
</emu-clause>

<emu-clause id="sec-asyncgenerator-prototype-throw">
<h1>AsyncGenerator.prototype.throw ( _exception_ )</h1>
<h1>%AsyncGeneratorPrototype%.throw ( _exception_ )</h1>
<emu-alg>
1. Let _generator_ be the *this* value.
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
Expand All @@ -47877,7 +47897,7 @@ <h1>AsyncGenerator.prototype.throw ( _exception_ )</h1>
</emu-clause>

<emu-clause id="sec-asyncgenerator-prototype-tostringtag">
<h1>AsyncGenerator.prototype [ @@toStringTag ]</h1>
<h1>%AsyncGeneratorPrototype% [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the String value *"AsyncGenerator"*.</p>
<p>This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
</emu-clause>
Expand Down

0 comments on commit fdde1c9

Please sign in to comment.