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

@lucacasonato commented on this pull request.



> +        1.  Return the IDL async iterable value that represents a reference to the JavaScript object
+            |V|, the JavaScript method |syncMethod|, and the flag <code>sync</code>.
+    1.  Return the IDL async iterable value that represents a reference to the JavaScript object
+        |V|, the JavaScript method |method|, and the flag <code>async</code>.
+</div>
+
+<div id="async-iterable-to-js" algorithm="convert an async iterable to a JavaScript value">
+    An IDL <a lt="async iterable type">async iterable&lt;<var ignore>T</var>&gt;</a> value is
+    [=converted to a JavaScript value|converted=] to a JavaScript object as follows:
+
+    1.  Return the JavaScript object that represents the same async iterable as the IDL value.
+</div>
+
+<h5 id="js-async-iterator">Async iterators</h5>
+
+IDL [=async iterator=] values are represented by JavaScript [=Iterator=] records.

Done. However I had to change `record` to `underlying record` because otherwise  multiple `[=record=]` (referring to the IDL type) that would emit link errors because multiple possible dfns of `record` existed (even if one of them was namespaced to `async iterator`). I couldn't figure out how to forciably link `[=record=]` to the IDL type.

> +                    1.  Let |finish| be the result of <a lt="close an async iterator">closing</a>
+                        |iterator| with reason <emu-val>undefined</emu-val>.
+                    1.  [=React=] to |finish|:
+                        -   If |finish| was fulfilled, [=resolve=] |promise| with |result|.
+                        -   If |finish| was rejected with reason |r|, [=reject=] |promise| with |r|.
+                1.  Otherwise:
+                    1.  Call |step|.
+            -   If |next| was rejected with reason |r|, [=reject=] |promise| with |r|.
+    1.  Call |step|.
+    1.  Return |promise|.
+
+</div>
+</div>
+
+
+</div>

Nothing

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

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

Received on Tuesday, 30 July 2024 12:33:43 UTC