wp/wp-includes/js/dist/vendor/regenerator-runtime.js
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    84   function GeneratorFunctionPrototype() {}
    84   function GeneratorFunctionPrototype() {}
    85 
    85 
    86   // This is a polyfill for %IteratorPrototype% for environments that
    86   // This is a polyfill for %IteratorPrototype% for environments that
    87   // don't natively support it.
    87   // don't natively support it.
    88   var IteratorPrototype = {};
    88   var IteratorPrototype = {};
    89   IteratorPrototype[iteratorSymbol] = function () {
    89   define(IteratorPrototype, iteratorSymbol, function () {
    90     return this;
    90     return this;
    91   };
    91   });
    92 
    92 
    93   var getProto = Object.getPrototypeOf;
    93   var getProto = Object.getPrototypeOf;
    94   var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
    94   var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
    95   if (NativeIteratorPrototype &&
    95   if (NativeIteratorPrototype &&
    96       NativeIteratorPrototype !== Op &&
    96       NativeIteratorPrototype !== Op &&
   100     IteratorPrototype = NativeIteratorPrototype;
   100     IteratorPrototype = NativeIteratorPrototype;
   101   }
   101   }
   102 
   102 
   103   var Gp = GeneratorFunctionPrototype.prototype =
   103   var Gp = GeneratorFunctionPrototype.prototype =
   104     Generator.prototype = Object.create(IteratorPrototype);
   104     Generator.prototype = Object.create(IteratorPrototype);
   105   GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
   105   GeneratorFunction.prototype = GeneratorFunctionPrototype;
   106   GeneratorFunctionPrototype.constructor = GeneratorFunction;
   106   define(Gp, "constructor", GeneratorFunctionPrototype);
       
   107   define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
   107   GeneratorFunction.displayName = define(
   108   GeneratorFunction.displayName = define(
   108     GeneratorFunctionPrototype,
   109     GeneratorFunctionPrototype,
   109     toStringTagSymbol,
   110     toStringTagSymbol,
   110     "GeneratorFunction"
   111     "GeneratorFunction"
   111   );
   112   );
   215     // .throw, and .return (see defineIteratorMethods).
   216     // .throw, and .return (see defineIteratorMethods).
   216     this._invoke = enqueue;
   217     this._invoke = enqueue;
   217   }
   218   }
   218 
   219 
   219   defineIteratorMethods(AsyncIterator.prototype);
   220   defineIteratorMethods(AsyncIterator.prototype);
   220   AsyncIterator.prototype[asyncIteratorSymbol] = function () {
   221   define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
   221     return this;
   222     return this;
   222   };
   223   });
   223   exports.AsyncIterator = AsyncIterator;
   224   exports.AsyncIterator = AsyncIterator;
   224 
   225 
   225   // Note that simple async functions are implemented on top of
   226   // Note that simple async functions are implemented on top of
   226   // AsyncIterator objects; they just return a Promise for the value of
   227   // AsyncIterator objects; they just return a Promise for the value of
   227   // the final result produced by the iterator.
   228   // the final result produced by the iterator.
   410   // A Generator should always return itself as the iterator object when the
   411   // A Generator should always return itself as the iterator object when the
   411   // @@iterator function is called on it. Some browsers' implementations of the
   412   // @@iterator function is called on it. Some browsers' implementations of the
   412   // iterator prototype chain incorrectly implement this, causing the Generator
   413   // iterator prototype chain incorrectly implement this, causing the Generator
   413   // object to not be returned from this call. This ensures that doesn't happen.
   414   // object to not be returned from this call. This ensures that doesn't happen.
   414   // See https://github.com/facebook/regenerator/issues/274 for more details.
   415   // See https://github.com/facebook/regenerator/issues/274 for more details.
   415   Gp[iteratorSymbol] = function() {
   416   define(Gp, iteratorSymbol, function() {
   416     return this;
   417     return this;
   417   };
   418   });
   418 
   419 
   419   Gp.toString = function() {
   420   define(Gp, "toString", function() {
   420     return "[object Generator]";
   421     return "[object Generator]";
   421   };
   422   });
   422 
   423 
   423   function pushTryEntry(locs) {
   424   function pushTryEntry(locs) {
   424     var entry = { tryLoc: locs[0] };
   425     var entry = { tryLoc: locs[0] };
   425 
   426 
   426     if (1 in locs) {
   427     if (1 in locs) {
   735 try {
   736 try {
   736   regeneratorRuntime = runtime;
   737   regeneratorRuntime = runtime;
   737 } catch (accidentalStrictMode) {
   738 } catch (accidentalStrictMode) {
   738   // This module should not be running in strict mode, so the above
   739   // This module should not be running in strict mode, so the above
   739   // assignment should always work unless something is misconfigured. Just
   740   // assignment should always work unless something is misconfigured. Just
   740   // in case runtime.js accidentally runs in strict mode, we can escape
   741   // in case runtime.js accidentally runs in strict mode, in modern engines
       
   742   // we can explicitly access globalThis. In older engines we can escape
   741   // strict mode using a global Function call. This could conceivably fail
   743   // strict mode using a global Function call. This could conceivably fail
   742   // if a Content Security Policy forbids using Function, but in that case
   744   // if a Content Security Policy forbids using Function, but in that case
   743   // the proper solution is to fix the accidental strict mode problem. If
   745   // the proper solution is to fix the accidental strict mode problem. If
   744   // you've misconfigured your bundler to force strict mode and applied a
   746   // you've misconfigured your bundler to force strict mode and applied a
   745   // CSP to forbid Function, and you're not willing to fix either of those
   747   // CSP to forbid Function, and you're not willing to fix either of those
   746   // problems, please detail your unique predicament in a GitHub issue.
   748   // problems, please detail your unique predicament in a GitHub issue.
   747   Function("r", "regeneratorRuntime = r")(runtime);
   749   if (typeof globalThis === "object") {
       
   750     globalThis.regeneratorRuntime = runtime;
       
   751   } else {
       
   752     Function("r", "regeneratorRuntime = r")(runtime);
       
   753   }
   748 }
   754 }