diff options
Diffstat (limited to 'core/00_primordials.js')
-rw-r--r-- | core/00_primordials.js | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/core/00_primordials.js b/core/00_primordials.js index d48dfde79..19e16860f 100644 --- a/core/00_primordials.js +++ b/core/00_primordials.js @@ -248,6 +248,24 @@ copyPrototype(original.prototype, primordials, `${name}Prototype`); }); + const { + ArrayPrototypeForEach, + ArrayPrototypeMap, + FunctionPrototypeCall, + Map, + ObjectDefineProperty, + ObjectFreeze, + ObjectPrototypeIsPrototypeOf, + ObjectSetPrototypeOf, + Promise, + PromisePrototype, + PromisePrototypeThen, + Set, + SymbolIterator, + WeakMap, + WeakSet, + } = primordials; + // Create copies of abstract intrinsic objects that are not directly exposed // on the global object. // Refs: https://tc39.es/ecma262/#sec-%typedarray%-intrinsic-object @@ -260,6 +278,18 @@ }, }, { + name: "SetIterator", + original: { + prototype: Reflect.getPrototypeOf(new Set()[Symbol.iterator]()), + }, + }, + { + name: "MapIterator", + original: { + prototype: Reflect.getPrototypeOf(new Map()[Symbol.iterator]()), + }, + }, + { name: "StringIterator", original: { prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()), @@ -273,24 +303,6 @@ copyPrototype(original.prototype, primordials, `${name}Prototype`); }); - const { - ArrayPrototypeForEach, - ArrayPrototypeMap, - FunctionPrototypeCall, - Map, - ObjectDefineProperty, - ObjectFreeze, - ObjectPrototypeIsPrototypeOf, - ObjectSetPrototypeOf, - Promise, - PromisePrototype, - PromisePrototypeThen, - Set, - SymbolIterator, - WeakMap, - WeakSet, - } = primordials; - // Because these functions are used by `makeSafe`, which is exposed // on the `primordials` object, it's important to use const references // to the primordials that they use: @@ -316,6 +328,14 @@ primordials.ArrayPrototypeSymbolIterator, primordials.ArrayIteratorPrototypeNext, ); + primordials.SafeSetIterator = createSafeIterator( + primordials.SetPrototypeSymbolIterator, + primordials.SetIteratorPrototypeNext, + ); + primordials.SafeMapIterator = createSafeIterator( + primordials.MapPrototypeSymbolIterator, + primordials.MapIteratorPrototypeNext, + ); primordials.SafeStringIterator = createSafeIterator( primordials.StringPrototypeSymbolIterator, primordials.StringIteratorPrototypeNext, |