Re: [whatwg/webidl] Add `async iterable<T>` type to WebIDL (PR #1397)

@domenic approved this pull request.

> What tests should I write for this? I don't think we have specific webidl tests in WPT, right? Only tests for features that use the webidl types.

This was discussed in https://github.com/whatwg/webidl/pull/1397#issuecomment-2021792761.

> @@ -6177,6 +6207,34 @@ sequence is used.
 Any [=list=] can be implicitly treated as a <code>sequence&lt;|T|&gt;</code>, as long as it contains
 only [=list/items=] that are of type |T|.
 
+<!-- Note: if we ever add synchronous iterable types, we should add a note here about why sequences and iterables are not the same. -->
+
+<h4 id="idl-async-iterable-type" lt="async iterable" dfn export>Async iterable types — async iterable&lt;|T|&gt;</h4>
+
+The <dfn lt="async iterable type" export>async iterable type</dfn> is a parameterized

```suggestion
An <dfn lt="async iterable type" export>async iterable type</dfn> is a parameterized
```

> @@ -8115,6 +8173,162 @@ JavaScript Array values.
 </div>
 
 
+<h4 id="js-async-iterable">Async iterable — async iterable&lt;|T|&gt;</h4>

```suggestion
<h4 id="js-async-iterable">Async iterables — async iterable&lt;|T|&gt;</h4>
```

(seems like the JS bindings section is very inconsistent on how its headings are named...)

> +        1.  Otherwise:
+            1.  Let |V| be [=?=] <a abstract-op>IteratorValue</a>(|iterResult|).
+            1.  Let |value| be the result of [=converted to an IDL value|converting=] |V| to an IDL
+                value of type |iterator|'s [=JS async iterator/type parameter=].
+            1.  Return |value|.
+
+</div>
+
+<div algorithm>
+
+    To <dfn id="async-iterator-close" export lt="close an async iterator">close</dfn> an
+    <code><a lt="async iterator">async iterator&lt;<var ignore>T</var>&gt;</a></code> |iterator|,
+    with a reason |reason|:
+
+    1.  Let |iteratorRecord| be |iterator|'s [=JS async iterator/underlying record=].
+    1.  Let |iteratorObj| be |iteratorRecord|.\[[Iterator]]

```suggestion
    1.  Let |iteratorObj| be |iteratorRecord|.\[[Iterator]].
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1397#pullrequestreview-2218042834
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1397/review/2218042834@github.com>

Received on Monday, 5 August 2024 05:42:47 UTC