From e1987d593002079612f779bfe9e7cb1d96df2e29 Mon Sep 17 00:00:00 2001 From: ExE Boss Date: Sun, 28 Nov 2021 05:50:00 +0100 Subject: [PATCH] =?UTF-8?q?Editorial:=20Add=C2=A0`Iterator=C2=A0Record`?= =?UTF-8?q?=C2=A0type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec.html | 72 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 9 deletions(-) diff --git a/spec.html b/spec.html index a5ea36fbc5a..0e6a592d7fb 100644 --- a/spec.html +++ b/spec.html @@ -6978,6 +6978,60 @@

Operations on Iterator Objects

See Common Iteration Interfaces ().

+ +

Iterator Records

+

A Iterator Record is a Record value used to encapsulate an Iterator or AsyncIterator along with the `next` method.

+

Iterator Records have the fields listed in .

+ + + + + + + + + + + + + + + + + + + + + + +
+ Field Name + + Value + + Meaning +
+ [[Iterator]] + + An object + + An object that conforms to the Iterator or AsyncIterator interface. +
+ [[NextMethod]] + + A function object + + The `next` method of the [[Iterator]] object. +
+ [[Done]] + + Boolean + + Whether the iterator has been closed. +
+
+
+

GetIterator ( @@ -7001,7 +7055,7 @@

1. Let _iterator_ be ? Call(_method_, _obj_). 1. If Type(_iterator_) is not Object, throw a *TypeError* exception. 1. Let _nextMethod_ be ? GetV(_iterator_, *"next"*). - 1. Let _iteratorRecord_ be the Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }. + 1. Let _iteratorRecord_ be the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }. 1. Return _iteratorRecord_. @@ -7009,7 +7063,7 @@

IteratorNext ( - _iteratorRecord_: unknown, + _iteratorRecord_: an Iterator Record, optional _value_: unknown, )

@@ -7054,7 +7108,7 @@

IteratorStep ( - _iteratorRecord_: unknown, + _iteratorRecord_: an Iterator Record, )

@@ -7072,7 +7126,7 @@

IteratorClose ( - _iteratorRecord_: unknown, + _iteratorRecord_: an Iterator Record, _completion_: a Completion Record, )

@@ -7111,7 +7165,7 @@

IfAbruptCloseIterator ( _value_, _iteratorRecord_ )

AsyncIteratorClose ( - _iteratorRecord_: unknown, + _iteratorRecord_: an Iterator Record, _completion_: a Completion Record, )

@@ -7170,7 +7224,7 @@

1. Perform ? Yield(_E_). 1. Return *undefined*. 1. Let _iterator_ be ! CreateIteratorFromClosure(_closure_, ~empty~, %IteratorPrototype%). - 1. Return Record { [[Iterator]]: _iterator_, [[NextMethod]]: %GeneratorFunction.prototype.prototype.next%, [[Done]]: *false* }. + 1. Return the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: %GeneratorFunction.prototype.prototype.next%, [[Done]]: *false* }.

The list iterator object is never directly accessible to ECMAScript code.

@@ -22043,7 +22097,7 @@

1. Let _obj_ be ! ToObject(_exprValue_). 1. Let _iterator_ be ? EnumerateObjectProperties(_obj_). 1. Let _nextMethod_ be ! GetV(_iterator_, *"next"*). - 1. Return the Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }. + 1. Return the Iterator Record { [[Iterator]]: _iterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }. 1. Else, 1. Assert: _iterationKind_ is ~iterate~ or ~async-iterate~. 1. If _iterationKind_ is ~async-iterate~, let _iteratorHint_ be ~async~. @@ -42994,13 +43048,13 @@

description
-
It is used to create an async iterator Record from a synchronous iterator Record.
+
It is used to create an async Iterator Record from a synchronous Iterator Record.
1. Let _asyncIterator_ be ! OrdinaryObjectCreate(%AsyncFromSyncIteratorPrototype%, « [[SyncIteratorRecord]] »). 1. Set _asyncIterator_.[[SyncIteratorRecord]] to _syncIteratorRecord_. 1. Let _nextMethod_ be ! Get(_asyncIterator_, *"next"*). - 1. Let _iteratorRecord_ be the Record { [[Iterator]]: _asyncIterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }. + 1. Let _iteratorRecord_ be the Iterator Record { [[Iterator]]: _asyncIterator_, [[NextMethod]]: _nextMethod_, [[Done]]: *false* }. 1. Return _iteratorRecord_.