- From: Dominic Farolino <notifications@github.com>
- Date: Sat, 25 Jan 2025 13:45:06 -0800
- To: whatwg/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/webidl/pull/1397/review/2574088419@github.com>
@domfarolino commented on this pull request. > +In the JavaScript binding, IDL [=async iterable type|async iterable=] values are represented by +a [=struct=] with the following [=struct/items=]: + +* <dfn for="JS async iterable">object</dfn>, a JavaScript value +* <dfn for="JS async iterable">method</dfn>, a JavaScript value +* <dfn for="JS async iterable">type</dfn>, either "<code>sync</code>" or "<code>async</code>" + + +<div id="js-to-async-iterable" algorithm="convert a JavaScript value to async iterable"> + A JavaScript value |V| is [=converted to an IDL value|converted=] + to an IDL <a lt="async iterable">async iterable<<var ignore>T</var>></a> value as follows: + + 1. If |V| [=is not an Object=], then + [=JavaScript/throw=] a <l spec=ecmascript>{{TypeError}}</l>. + 1. Let |method| be [=?=] <a abstract-op>GetMethod</a>(obj, {{%Symbol.asyncIterator%}}). + 1. If |method| is undefined: nit: For consistency with elsewhere (including within this PR), I guess we should use `<emu-val>undefined</emu-val>` here and below? > @@ -8686,6 +8906,18 @@ that correspond to the union's [=member types=]. 1. If |types| includes {{object}}, then return the IDL value that is a reference to the object |V|. 1. If |V| [=is an Object=], then: + 1. If |types| includes an [=async iterable type=], then + 1. If |types| does not include a [=string type=] or |V| does not have a \[[StringData]] [=/internal slot=], then Can we just say `, then return the result of converting V to an async iterable`, linking to [your conversion steps](https://whatpr.org/webidl/1397.html#ref-for-dfn-convert-ecmascript-to-idl-value%E2%91%A2%E2%91%A1) that seem to do the same thing as the below substeps? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/webidl/pull/1397#pullrequestreview-2574088419 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/webidl/pull/1397/review/2574088419@github.com>
Received on Saturday, 25 January 2025 21:45:10 UTC