Skip to content

Commit 85d910c

Browse files
ExE-Bossjmdyck
authored andcommitted
Editorial: Add Iterator Record type (#2591)
Co-authored-by: ExE Boss <ExE-Boss@code.ExE-Boss.tech> Co-authored-by: Michael Dyck <jmdyck@ibiblio.org>
1 parent ca53334 commit 85d910c

File tree

1 file changed

+71
-17
lines changed

1 file changed

+71
-17
lines changed

spec.html

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6909,12 +6909,66 @@ <h1>
69096909
<h1>Operations on Iterator Objects</h1>
69106910
<p>See Common Iteration Interfaces (<emu-xref href="#sec-iteration"></emu-xref>).</p>
69116911

6912+
<emu-clause id="sec-iterator-records">
6913+
<h1>Iterator Records</h1>
6914+
<p>An <dfn variants="Iterator Records">Iterator Record</dfn> is a Record value used to encapsulate an Iterator or AsyncIterator along with the `next` method.</p>
6915+
<p>Iterator Records have the fields listed in <emu-xref href="#table-iterator-record-fields"></emu-xref>.</p>
6916+
<emu-table id="table-iterator-record-fields" caption="Iterator Record Fields">
6917+
<table>
6918+
<tr>
6919+
<th>
6920+
Field Name
6921+
</th>
6922+
<th>
6923+
Value
6924+
</th>
6925+
<th>
6926+
Meaning
6927+
</th>
6928+
</tr>
6929+
<tr>
6930+
<td>
6931+
[[Iterator]]
6932+
</td>
6933+
<td>
6934+
An object
6935+
</td>
6936+
<td>
6937+
An object that conforms to the <i>Iterator</i> or <i>AsyncIterator</i> interface.
6938+
</td>
6939+
</tr>
6940+
<tr>
6941+
<td>
6942+
[[NextMethod]]
6943+
</td>
6944+
<td>
6945+
A function object
6946+
</td>
6947+
<td>
6948+
The `next` method of the [[Iterator]] object.
6949+
</td>
6950+
</tr>
6951+
<tr>
6952+
<td>
6953+
[[Done]]
6954+
</td>
6955+
<td>
6956+
Boolean
6957+
</td>
6958+
<td>
6959+
Whether the iterator has been closed.
6960+
</td>
6961+
</tr>
6962+
</table>
6963+
</emu-table>
6964+
</emu-clause>
6965+
69126966
<emu-clause id="sec-getiterator" type="abstract operation">
69136967
<h1>
69146968
GetIterator (
6915-
_obj_: unknown,
6969+
_obj_: an ECMAScript language value,
69166970
optional _hint_: ~sync~ or ~async~,
6917-
optional _method_: unknown,
6971+
optional _method_: a function object,
69186972
)
69196973
</h1>
69206974
<dl class="header">
@@ -6932,16 +6986,16 @@ <h1>
69326986
1. Let _iterator_ be ? Call(_method_, _obj_).
69336987
1. If Type(_iterator_) is not Object, throw a *TypeError* exception.
69346988
1. Let _nextMethod_ be ? GetV(_iterator_, *"next"*).
6935-
1. Let _iteratorRecord_ be the Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
6989+
1. Let _iteratorRecord_ be the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
69366990
1. Return _iteratorRecord_.
69376991
</emu-alg>
69386992
</emu-clause>
69396993

69406994
<emu-clause id="sec-iteratornext" type="abstract operation">
69416995
<h1>
69426996
IteratorNext (
6943-
_iteratorRecord_: unknown,
6944-
optional _value_: unknown,
6997+
_iteratorRecord_: an Iterator Record,
6998+
optional _value_: an ECMAScript language value,
69456999
)
69467000
</h1>
69477001
<dl class="header">
@@ -6985,7 +7039,7 @@ <h1>
69857039
<emu-clause id="sec-iteratorstep" type="abstract operation">
69867040
<h1>
69877041
IteratorStep (
6988-
_iteratorRecord_: unknown,
7042+
_iteratorRecord_: an Iterator Record,
69897043
)
69907044
</h1>
69917045
<dl class="header">
@@ -7003,7 +7057,7 @@ <h1>
70037057
<emu-clause id="sec-iteratorclose" type="abstract operation">
70047058
<h1>
70057059
IteratorClose (
7006-
_iteratorRecord_: unknown,
7060+
_iteratorRecord_: an Iterator Record,
70077061
_completion_: a Completion Record,
70087062
)
70097063
</h1>
@@ -7042,7 +7096,7 @@ <h1>IfAbruptCloseIterator ( _value_, _iteratorRecord_ )</h1>
70427096
<emu-clause id="sec-asynciteratorclose" type="abstract operation">
70437097
<h1>
70447098
AsyncIteratorClose (
7045-
_iteratorRecord_: unknown,
7099+
_iteratorRecord_: an Iterator Record,
70467100
_completion_: a Completion Record,
70477101
)
70487102
</h1>
@@ -7069,7 +7123,7 @@ <h1>
70697123
<emu-clause id="sec-createiterresultobject" type="abstract operation">
70707124
<h1>
70717125
CreateIterResultObject (
7072-
_value_: unknown,
7126+
_value_: an ECMAScript language value,
70737127
_done_: a Boolean,
70747128
)
70757129
</h1>
@@ -7088,7 +7142,7 @@ <h1>
70887142
<emu-clause id="sec-createlistiteratorRecord" type="abstract operation" oldids="sec-createlistiterator,sec-listiteratornext-functions,sec-listiterator-next">
70897143
<h1>
70907144
CreateListIteratorRecord (
7091-
_list_: unknown,
7145+
_list_: a List,
70927146
)
70937147
</h1>
70947148
<dl class="header">
@@ -7101,7 +7155,7 @@ <h1>
71017155
1. Perform ? GeneratorYield(! CreateIterResultObject(_E_, *false*)).
71027156
1. Return *undefined*.
71037157
1. Let _iterator_ be ! CreateIteratorFromClosure(_closure_, ~empty~, %IteratorPrototype%).
7104-
1. Return Record { [[Iterator]]: _iterator_, [[NextMethod]]: %GeneratorFunction.prototype.prototype.next%, [[Done]]: *false* }.
7158+
1. Return the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: %GeneratorFunction.prototype.prototype.next%, [[Done]]: *false* }.
71057159
</emu-alg>
71067160
<emu-note>
71077161
<p>The list iterator object is never directly accessible to ECMAScript code.</p>
@@ -7111,8 +7165,8 @@ <h1>
71117165
<emu-clause id="sec-iterabletolist" type="abstract operation">
71127166
<h1>
71137167
IterableToList (
7114-
_items_: unknown,
7115-
optional _method_: unknown,
7168+
_items_: an ECMAScript language value,
7169+
optional _method_: a function object,
71167170
)
71177171
</h1>
71187172
<dl class="header">
@@ -21958,7 +22012,7 @@ <h1>
2195822012
1. Let _obj_ be ! ToObject(_exprValue_).
2195922013
1. Let _iterator_ be ? EnumerateObjectProperties(_obj_).
2196022014
1. Let _nextMethod_ be ! GetV(_iterator_, *"next"*).
21961-
1. Return the Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
22015+
1. Return the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
2196222016
1. Else,
2196322017
1. Assert: _iterationKind_ is ~iterate~ or ~async-iterate~.
2196422018
1. If _iterationKind_ is ~async-iterate~, let _iteratorHint_ be ~async~.
@@ -42876,13 +42930,13 @@ <h1>
4287642930
</h1>
4287742931
<dl class="header">
4287842932
<dt>description</dt>
42879-
<dd>It is used to create an async iterator Record from a synchronous iterator Record.</dd>
42933+
<dd>It is used to create an async Iterator Record from a synchronous Iterator Record.</dd>
4288042934
</dl>
4288142935
<emu-alg>
4288242936
1. Let _asyncIterator_ be ! OrdinaryObjectCreate(%AsyncFromSyncIteratorPrototype%, &laquo; [[SyncIteratorRecord]] &raquo;).
4288342937
1. Set _asyncIterator_.[[SyncIteratorRecord]] to _syncIteratorRecord_.
4288442938
1. Let _nextMethod_ be ! Get(_asyncIterator_, *"next"*).
42885-
1. Let _iteratorRecord_ be the Record { [[Iterator]]: _asyncIterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
42939+
1. Let _iteratorRecord_ be the Iterator Record { [[Iterator]]: _asyncIterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }.
4288642940
1. Return _iteratorRecord_.
4288742941
</emu-alg>
4288842942
</emu-clause>
@@ -42986,7 +43040,7 @@ <h1>Properties of Async-from-Sync Iterator Instances</h1>
4298643040
[[SyncIteratorRecord]]
4298743041
</td>
4298843042
<td>
42989-
A Record, of the type returned by GetIterator, representing the original synchronous iterator which is being adapted.
43043+
An Iterator Record representing the original synchronous iterator which is being adapted.
4299043044
</td>
4299143045
</tr>
4299243046
</table>

0 commit comments

Comments
 (0)