@@ -202,6 +202,7 @@ function copyPrototype(src, dest, prefix) {
202202 'Int16Array' ,
203203 'Int32Array' ,
204204 'Int8Array' ,
205+ 'Iterator' ,
205206 'Map' ,
206207 'Number' ,
207208 'Object' ,
@@ -230,10 +231,10 @@ function copyPrototype(src, dest, prefix) {
230231} ) ;
231232
232233
233- // Create copies of intrinsic objects that require a valid `this` to call
234- // static methods.
235- // Refs: https://www.ecma-international.org/ecma-262/#sec-promise.all
234+ // Create copies of intrinsic objects whose static methods require the
235+ // constructor to be passed as the receiver.
236236[
237+ // Refs: https://tc39.es/ecma-262/#sec-promise.all
237238 'Promise' ,
238239] . forEach ( ( name ) => {
239240 // eslint-disable-next-line no-restricted-globals
@@ -244,25 +245,36 @@ function copyPrototype(src, dest, prefix) {
244245} ) ;
245246
246247// Create copies of abstract intrinsic objects that are not directly exposed
247- // on the global object.
248- // Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
248+ // on the global object, and whose static methods require a valid subclass
249+ // constructor to be passed as the receiver.
249250[
251+ // Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object
250252 { name : 'TypedArray' , original : Reflect . getPrototypeOf ( Uint8Array ) } ,
251- { name : 'ArrayIterator' , original : {
252- prototype : Reflect . getPrototypeOf ( Array . prototype [ Symbol . iterator ] ( ) ) ,
253- } } ,
254- { name : 'StringIterator' , original : {
255- prototype : Reflect . getPrototypeOf ( String . prototype [ Symbol . iterator ] ( ) ) ,
256- } } ,
257253] . forEach ( ( { name, original } ) => {
258254 primordials [ name ] = original ;
259- // The static %TypedArray% methods require a valid `this`, but can't be bound,
260- // as they need a subclass constructor as the receiver:
261255 copyPrototype ( original , primordials , name ) ;
262256 copyPrototype ( original . prototype , primordials , `${ name } Prototype` ) ;
263257} ) ;
264258
265- primordials . IteratorPrototype = Reflect . getPrototypeOf ( primordials . ArrayIteratorPrototype ) ;
259+ // Create copies of abstract intrinsic prototypes that are not directly exposed
260+ // on the global object and which do not have corresponding constructors.
261+ [
262+ {
263+ name : 'ArrayIteratorPrototype' ,
264+ original : Reflect . getPrototypeOf ( Array . prototype [ Symbol . iterator ] ( ) ) ,
265+ } ,
266+ {
267+ name : 'AsyncIteratorPrototype' ,
268+ original : Reflect . getPrototypeOf ( Reflect . getPrototypeOf ( async function * ( ) { } ) . prototype ) ,
269+ } ,
270+ {
271+ name : 'StringIteratorPrototype' ,
272+ original : Reflect . getPrototypeOf ( String . prototype [ Symbol . iterator ] ( ) ) ,
273+ } ,
274+ ] . forEach ( ( { name, original } ) => {
275+ primordials [ name ] = original ;
276+ copyPrototype ( original , primordials , name ) ;
277+ } ) ;
266278
267279/* eslint-enable node-core/prefer-primordials */
268280
@@ -453,11 +465,6 @@ primordials.SafePromisePrototypeFinally = (thisPromise, onFinally) =>
453465 . then ( a , b ) ,
454466 ) ;
455467
456- primordials . AsyncIteratorPrototype =
457- primordials . ReflectGetPrototypeOf (
458- primordials . ReflectGetPrototypeOf (
459- async function * ( ) { } ) . prototype ) ;
460-
461468const arrayToSafePromiseIterable = ( promises , mapFn ) =>
462469 new primordials . SafeArrayIterator (
463470 ArrayPrototypeMap (
0 commit comments