lib: prefer AsyncIteratorPrototype primordial

PR-URL: https://github.com/nodejs/node/pull/59097
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
René 2025-07-29 22:54:16 +01:00 committed by GitHub
parent cd0c5159e6
commit eabb75cea8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 7 deletions

View file

@ -28,6 +28,7 @@ const {
ArrayPrototypeSlice,
ArrayPrototypeSplice,
ArrayPrototypeUnshift,
AsyncIteratorPrototype,
Boolean,
Error,
ErrorCaptureStackTrace,
@ -1000,9 +1001,6 @@ async function once(emitter, name, options = kEmptyObject) {
});
}
const AsyncIteratorPrototype = ObjectGetPrototypeOf(
ObjectGetPrototypeOf(async function* () {}).prototype);
function createIterResult(value, done) {
return { value, done };
}

View file

@ -31,6 +31,7 @@ const {
ArrayPrototype,
ArrayPrototypeForEach,
ArrayPrototypePush,
AsyncIteratorPrototype,
Atomics,
BigInt,
BigInt64Array,
@ -212,10 +213,7 @@ module.exports = function() {
// 27 Control Abstraction Objects
// 27.1 Iteration
IteratorPrototype, // 27.1.2 IteratorPrototype
// 27.1.3 AsyncIteratorPrototype
ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf(
(async function*() {})(),
))),
AsyncIteratorPrototype, // 27.1.3 AsyncIteratorPrototype
PromisePrototype, // 27.2
// Other APIs / Web Compatibility