Skip to content

Commit 6aec5ae

Browse files
Renegade334aduh95
authored andcommitted
lib: prefer AsyncIteratorPrototype primordial
PR-URL: #59097 Reviewed-By: Jordan Harband <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
1 parent 9b9d300 commit 6aec5ae

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

lib/events.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const {
2828
ArrayPrototypeSlice,
2929
ArrayPrototypeSplice,
3030
ArrayPrototypeUnshift,
31+
AsyncIteratorPrototype,
3132
Boolean,
3233
Error,
3334
ErrorCaptureStackTrace,
@@ -1011,9 +1012,6 @@ async function once(emitter, name, options = kEmptyObject) {
10111012
});
10121013
}
10131014

1014-
const AsyncIteratorPrototype = ObjectGetPrototypeOf(
1015-
ObjectGetPrototypeOf(async function* () {}).prototype);
1016-
10171015
function createIterResult(value, done) {
10181016
return { value, done };
10191017
}

lib/internal/freeze_intrinsics.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const {
3131
ArrayPrototype,
3232
ArrayPrototypeForEach,
3333
ArrayPrototypePush,
34+
AsyncIteratorPrototype,
3435
Atomics,
3536
BigInt,
3637
BigInt64Array,
@@ -212,10 +213,7 @@ module.exports = function() {
212213
// 27 Control Abstraction Objects
213214
// 27.1 Iteration
214215
IteratorPrototype, // 27.1.2 IteratorPrototype
215-
// 27.1.3 AsyncIteratorPrototype
216-
ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf(
217-
(async function*() {})(),
218-
))),
216+
AsyncIteratorPrototype, // 27.1.3 AsyncIteratorPrototype
219217
PromisePrototype, // 27.2
220218

221219
// Other APIs / Web Compatibility

0 commit comments

Comments
 (0)