Files
scriptc/packages
Chris Tate 120c65bfbb Read an iterator's next once, and await return()'s value in for await
JavaScript reads an iterator's `next` when the iterator opens and keeps
calling that function, so a `next` the iterator assigns while it runs is
not called. The for-of loop and the spread drain over an object-literal
iterator read the field on every step; they now read it once after the
open (classIteratorNextRead) and call the function they read. The
checked-dynamic spread drain (%iterator.pack.checked) does the same,
using the stepping the for-of and Array.from drains already use.

`for await` over a synchronous iterator closes it on an early exit the
way the async-from-sync iterator does: return()'s result is read for done
and value, and the value is awaited, so a pending promise settles before
the loop continues and a rejected one rejects the loop (after a throw from
the body, the body's error still wins).
2026-10-24 20:24:11 -05:00
..
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00
2026-10-22 06:55:45 -05:00
2026-10-21 09:51:40 -05:00
2026-10-21 09:51:40 -05:00