mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-07 08:33:50 +08:00
A class with a parameterless *[Symbol.iterator]() generator method can now be iterated by for-of, array spread, Array.from, Math.max and Math.min spreads, new Set, new Map, Object.fromEntries and Iterator.from. Each site calls the method once and drives the generator it returns. obj[Symbol.iterator]() and the other well-known symbol methods called through element access now call the class's method, so iterator helpers apply to the result instead of failing on an untyped value. Writes that can replace a well-known symbol method (a symbol-keyed write, Object.defineProperty, a prototype write) now enter the method census, and those classes keep the existing checked or refused paths.