Commit Graph
3 Commits
Author SHA1 Message Date
dotCooCoo 18118db9c7 Merge main into feat/js-es2015-generators 2026-11-25 09:11:32 -08:00
dotCooCoo d73d0c0f9b JavaScript: a yield reserves only the heap its saved frame takes
A yield reserved room for every finally entry on the interpreter, those
of the frames under the generator's included, and for the result it
hands back, while the saved frame keeps only its own operands and
entries. Under deep callers in finally blocks a yield could stop at the
heap limit with enough room for its frame. It now reserves what the
saved frame keeps.

The tests check the value a throw raises in a generator that has not
started, and the fuel each call of a completed generator's next takes
against a native method that takes none.

docs/mcp.md and docs/target-app-parity.md say that an engine a .js
script makes has Symbol and the iterators, and that one a .jsx script or
a source string makes does not. The parity entry no longer says that
spread is missing or that scripts call next() themselves.
2026-11-22 11:27:41 -08:00
dotCooCoo 30eb12aba3 JavaScript: generator functions, yield and yield* in ES2015 realms
A realm made with Options::es2015 reads function* declarations and
expressions, *name() methods in object literals, yield and yield*, as
ECMA-262 11th edition sections 14.4 and 25.4 define them. A suspended
generator keeps its frame in its object; next, return and throw on
%GeneratorPrototype% push it back on the interpreter's frame stack, so
a resumption takes fuel and counts against the frame limit, and return
runs the finally blocks around the yield. Resuming a running generator
throws a TypeError. yield* passes next, throw and return on to its
iterator and closes one without throw before throwing a TypeError.
%GeneratorFunction% is reached through a generator function's
constructor. Outside generators, sloppy code still reads yield as a
name, and a realm without the option reads function* as a syntax error.

An engine that #targetengine kept from a .jsx run has no generator
built-ins, so a generator function called there throws a TypeError.

cargo xtask test262 runs the generator folders: 509 of 549 runs pass
(94 of 96 before). Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-22 08:15:47 -08:00