1 var global = require('../internals/global');
2 var shared = require('../internals/shared-store');
3 var getPrototypeOf = require('../internals/object-get-prototype-of');
4 var has = require('../internals/has');
5 var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
6 var wellKnownSymbol = require('../internals/well-known-symbol');
7 var IS_PURE = require('../internals/is-pure');
9 var USE_FUNCTION_CONSTRUCTOR = 'USE_FUNCTION_CONSTRUCTOR';
10 var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator');
11 var AsyncIterator = global.AsyncIterator;
12 var PassedAsyncIteratorPrototype = shared.AsyncIteratorPrototype;
13 var AsyncIteratorPrototype, prototype;
16 if (PassedAsyncIteratorPrototype) {
17 AsyncIteratorPrototype = PassedAsyncIteratorPrototype;
18 } else if (typeof AsyncIterator == 'function') {
19 AsyncIteratorPrototype = AsyncIterator.prototype;
20 } else if (shared[USE_FUNCTION_CONSTRUCTOR] || global[USE_FUNCTION_CONSTRUCTOR]) {
22 // eslint-disable-next-line no-new-func -- we have no alternatives without usage of modern syntax
23 prototype = getPrototypeOf(getPrototypeOf(getPrototypeOf(Function('return async function*(){}()')())));
24 if (getPrototypeOf(prototype) === Object.prototype) AsyncIteratorPrototype = prototype;
25 } catch (error) { /* empty */ }
29 if (!AsyncIteratorPrototype) AsyncIteratorPrototype = {};
31 if (!has(AsyncIteratorPrototype, ASYNC_ITERATOR)) {
32 createNonEnumerableProperty(AsyncIteratorPrototype, ASYNC_ITERATOR, function () {
37 module.exports = AsyncIteratorPrototype;