diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-01-15 13:26:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-15 04:26:05 +0000 |
commit | 1dc3609ff22e6a7be4d86d2ba983f81dfd8c1fd4 (patch) | |
tree | 7521bbcca4298a492480dd291e91a5e06cd9c4a0 /core/00_primordials.js | |
parent | d5634164cb86771fc279468cbb93e311c1ad3089 (diff) |
fix(core): Add `Generator` and `AsyncGenerator` to promordials (#17241)
Diffstat (limited to 'core/00_primordials.js')
-rw-r--r-- | core/00_primordials.js | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/core/00_primordials.js b/core/00_primordials.js index 33d7299d5..d394d1294 100644 --- a/core/00_primordials.js +++ b/core/00_primordials.js @@ -248,24 +248,6 @@ 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 @@ -295,6 +277,11 @@ prototype: Reflect.getPrototypeOf(String.prototype[Symbol.iterator]()), }, }, + { name: "Generator", original: Reflect.getPrototypeOf(function* () {}) }, + { + name: "AsyncGenerator", + original: Reflect.getPrototypeOf(async function* () {}), + }, ].forEach(({ name, original }) => { primordials[name] = original; // The static %TypedArray% methods require a valid `this`, but can't be bound, @@ -303,6 +290,20 @@ copyPrototype(original.prototype, primordials, `${name}Prototype`); }); + const { + ArrayPrototypeForEach, + ArrayPrototypeMap, + FunctionPrototypeCall, + ObjectDefineProperty, + ObjectFreeze, + ObjectPrototypeIsPrototypeOf, + ObjectSetPrototypeOf, + Promise, + PromisePrototype, + PromisePrototypeThen, + SymbolIterator, + } = 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: |