Skip to content

Commit 5b2363b

Browse files
Renegade334RafaelGSS
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 848e49c commit 5b2363b

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,
@@ -1000,9 +1001,6 @@ async function once(emitter, name, options = kEmptyObject) {
10001001
});
10011002
}
10021003

1003-
const AsyncIteratorPrototype = ObjectGetPrototypeOf(
1004-
ObjectGetPrototypeOf(async function* () {}).prototype);
1005-
10061004
function createIterResult(value, done) {
10071005
return { value, done };
10081006
}

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)