[whatwg/webidl] Editorial: Use CreateBuiltinFunction for (async) iterator return and next methods (PR #1610)

> This makes it explicit what the `name` and `length` of these methods is.
> Many other functions created by WebIDL already use CreateBuiltinFunction.

This is already tested by https://github.com/web-platform-tests/wpt/blob/8e113d970b5ef2b6c0b9a81f38dd6dbadaa31795/streams/readable-streams/async-iterator.any.js#L38-L39.

In ECMA-262 these `.return()`/`.next()` methods have length of 0 or 1 depending on whether they use their argument or not, so it's probably ok for WebIDL to have `.next()` have length of 0 and `.return(value)` have length of 1.

Right now it was a bit implicit, because we were defining _steps_ taking 0/1 parameters, but not actual JS functions.
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/webidl/pull/1610

-- Commit Summary --

  * Editorial: Use CreateBuiltinFunction for (async) iterator return and next methods

-- File Changes --

    M index.bs (10)

-- Patch Links --

https://github.com/whatwg/webidl/pull/1610.patch
https://github.com/whatwg/webidl/pull/1610.diff

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

Message ID: <whatwg/webidl/pull/1610@github.com>

Received on Wednesday, 17 June 2026 14:16:21 UTC