|
@@ -0,0 +1,622 @@
|
|
|
+/**
|
|
|
+ * Copyright (c) 2014-present, Facebook, Inc.
|
|
|
+ *
|
|
|
+ * This source code is licensed under the MIT license found in the
|
|
|
+ * LICENSE file in the root directory of this source tree.
|
|
|
+ */
|
|
|
+
|
|
|
+var regeneratorRuntime = (function (exports) {
|
|
|
+ "use strict";
|
|
|
+
|
|
|
+ var Op = Object.prototype;
|
|
|
+ var hasOwn = Op.hasOwnProperty;
|
|
|
+ var undefined; // More compressible than void 0.
|
|
|
+ var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
|
+ var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
|
+ var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
|
+ var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
|
+
|
|
|
+ function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
|
+ // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
|
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
|
+ var generator = Object.create(protoGenerator.prototype);
|
|
|
+ var context = new Context(tryLocsList || []);
|
|
|
+
|
|
|
+ // The ._invoke method unifies the implementations of the .next,
|
|
|
+ // .throw, and .return methods.
|
|
|
+ generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
|
+
|
|
|
+ return generator;
|
|
|
+ }
|
|
|
+ exports.wrap = wrap;
|
|
|
+
|
|
|
+ function tryCatch(fn, obj, arg) {
|
|
|
+ try {
|
|
|
+ return { type: "normal", arg: fn.call(obj, arg) };
|
|
|
+ } catch (err) {
|
|
|
+ return { type: "throw", arg: err };
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var GenStateSuspendedStart = "suspendedStart";
|
|
|
+ var GenStateSuspendedYield = "suspendedYield";
|
|
|
+ var GenStateExecuting = "executing";
|
|
|
+ var GenStateCompleted = "completed";
|
|
|
+
|
|
|
+ var ContinueSentinel = {};
|
|
|
+
|
|
|
+ function Generator() {}
|
|
|
+ function GeneratorFunction() {}
|
|
|
+ function GeneratorFunctionPrototype() {}
|
|
|
+
|
|
|
+ // This is a polyfill for %IteratorPrototype% for environments that
|
|
|
+ // don't natively support it.
|
|
|
+ var IteratorPrototype = {};
|
|
|
+ IteratorPrototype[iteratorSymbol] = function () {
|
|
|
+ return this;
|
|
|
+ };
|
|
|
+
|
|
|
+ var getProto = Object.getPrototypeOf;
|
|
|
+ var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
|
+ if (NativeIteratorPrototype &&
|
|
|
+ NativeIteratorPrototype !== Op &&
|
|
|
+ hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
|
+ // This environment has a native %IteratorPrototype%; use it instead
|
|
|
+ // of the polyfill.
|
|
|
+ IteratorPrototype = NativeIteratorPrototype;
|
|
|
+ }
|
|
|
+
|
|
|
+ var Gp = GeneratorFunctionPrototype.prototype =
|
|
|
+ Generator.prototype = Object.create(IteratorPrototype);
|
|
|
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
|
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
|
+ GeneratorFunctionPrototype[toStringTagSymbol] =
|
|
|
+ GeneratorFunction.displayName = "GeneratorFunction";
|
|
|
+
|
|
|
+ // Helper for defining the .next, .throw, and .return methods of the
|
|
|
+ // Iterator interface in terms of a single ._invoke method.
|
|
|
+ function defineIteratorMethods(prototype) {
|
|
|
+ ["next", "throw", "return"].forEach(function(method) {
|
|
|
+ prototype[method] = function(arg) {
|
|
|
+ return this._invoke(method, arg);
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ exports.isGeneratorFunction = function(genFun) {
|
|
|
+ var ctor = typeof genFun === "function" && genFun.constructor;
|
|
|
+ return ctor
|
|
|
+ ? ctor === GeneratorFunction ||
|
|
|
+ // For the native GeneratorFunction constructor, the best we can
|
|
|
+ // do is to check its .name property.
|
|
|
+ (ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
|
+ : false;
|
|
|
+ };
|
|
|
+
|
|
|
+ exports.mark = function(genFun) {
|
|
|
+ if (Object.setPrototypeOf) {
|
|
|
+ Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
|
+ } else {
|
|
|
+ genFun.__proto__ = GeneratorFunctionPrototype;
|
|
|
+ if (!(toStringTagSymbol in genFun)) {
|
|
|
+ genFun[toStringTagSymbol] = "GeneratorFunction";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ genFun.prototype = Object.create(Gp);
|
|
|
+ return genFun;
|
|
|
+ };
|
|
|
+
|
|
|
+ // Within the body of any async function, `await x` is transformed to
|
|
|
+ // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
|
+ // `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
|
+ // meant to be awaited.
|
|
|
+ exports.awrap = function(arg) {
|
|
|
+ return { __await: arg };
|
|
|
+ };
|
|
|
+
|
|
|
+ function AsyncIterator(generator) {
|
|
|
+ function invoke(method, arg, resolve, reject) {
|
|
|
+ var record = tryCatch(generator[method], generator, arg);
|
|
|
+ if (record.type === "throw") {
|
|
|
+ reject(record.arg);
|
|
|
+ } else {
|
|
|
+ var result = record.arg;
|
|
|
+ var value = result.value;
|
|
|
+ if (value &&
|
|
|
+ typeof value === "object" &&
|
|
|
+ hasOwn.call(value, "__await")) {
|
|
|
+ return Promise.resolve(value.__await).then(function(value) {
|
|
|
+ invoke("next", value, resolve, reject);
|
|
|
+ }, function(err) {
|
|
|
+ invoke("throw", err, resolve, reject);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return Promise.resolve(value).then(function(unwrapped) {
|
|
|
+ // When a yielded Promise is resolved, its final value becomes
|
|
|
+ // the .value of the Promise<{value,done}> result for the
|
|
|
+ // current iteration.
|
|
|
+ result.value = unwrapped;
|
|
|
+ resolve(result);
|
|
|
+ }, function(error) {
|
|
|
+ // If a rejected Promise was yielded, throw the rejection back
|
|
|
+ // into the async generator function so it can be handled there.
|
|
|
+ return invoke("throw", error, resolve, reject);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var previousPromise;
|
|
|
+
|
|
|
+ function enqueue(method, arg) {
|
|
|
+ function callInvokeWithMethodAndArg() {
|
|
|
+ return new Promise(function(resolve, reject) {
|
|
|
+ invoke(method, arg, resolve, reject);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return previousPromise =
|
|
|
+ previousPromise ? previousPromise.then(
|
|
|
+ callInvokeWithMethodAndArg,
|
|
|
+ callInvokeWithMethodAndArg
|
|
|
+ ) : callInvokeWithMethodAndArg();
|
|
|
+ }
|
|
|
+ this._invoke = enqueue;
|
|
|
+ }
|
|
|
+
|
|
|
+ defineIteratorMethods(AsyncIterator.prototype);
|
|
|
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
|
+ return this;
|
|
|
+ };
|
|
|
+ exports.AsyncIterator = AsyncIterator;
|
|
|
+
|
|
|
+ // Note that simple async functions are implemented on top of
|
|
|
+ // AsyncIterator objects; they just return a Promise for the value of
|
|
|
+ // the final result produced by the iterator.
|
|
|
+ exports.async = function(innerFn, outerFn, self, tryLocsList) {
|
|
|
+ var iter = new AsyncIterator(
|
|
|
+ wrap(innerFn, outerFn, self, tryLocsList)
|
|
|
+ );
|
|
|
+
|
|
|
+ return exports.isGeneratorFunction(outerFn)
|
|
|
+ ? iter // If outerFn is a generator, return the full iterator.
|
|
|
+ : iter.next().then(function(result) {
|
|
|
+ return result.done ? result.value : iter.next();
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ function makeInvokeMethod(innerFn, self, context) {
|
|
|
+ var state = GenStateSuspendedStart;
|
|
|
+
|
|
|
+ return function invoke(method, arg) {
|
|
|
+ if (state === GenStateExecuting) {
|
|
|
+ throw new Error("Generator is already running");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (state === GenStateCompleted) {
|
|
|
+ if (method === "throw") {
|
|
|
+ throw arg;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
|
+ // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
|
+ return doneResult();
|
|
|
+ }
|
|
|
+
|
|
|
+ context.method = method;
|
|
|
+ context.arg = arg;
|
|
|
+
|
|
|
+ while (true) {
|
|
|
+ var delegate = context.delegate;
|
|
|
+ if (delegate) {
|
|
|
+ var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
|
+ if (delegateResult) {
|
|
|
+ if (delegateResult === ContinueSentinel) continue;
|
|
|
+ return delegateResult;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (context.method === "next") {
|
|
|
+ // Setting context._sent for legacy support of Babel's
|
|
|
+ // function.sent implementation.
|
|
|
+ context.sent = context._sent = context.arg;
|
|
|
+
|
|
|
+ } else if (context.method === "throw") {
|
|
|
+ if (state === GenStateSuspendedStart) {
|
|
|
+ state = GenStateCompleted;
|
|
|
+ throw context.arg;
|
|
|
+ }
|
|
|
+
|
|
|
+ context.dispatchException(context.arg);
|
|
|
+
|
|
|
+ } else if (context.method === "return") {
|
|
|
+ context.abrupt("return", context.arg);
|
|
|
+ }
|
|
|
+
|
|
|
+ state = GenStateExecuting;
|
|
|
+
|
|
|
+ var record = tryCatch(innerFn, self, context);
|
|
|
+ if (record.type === "normal") {
|
|
|
+ // If an exception is thrown from innerFn, we leave state ===
|
|
|
+ // GenStateExecuting and loop back for another invocation.
|
|
|
+ state = context.done
|
|
|
+ ? GenStateCompleted
|
|
|
+ : GenStateSuspendedYield;
|
|
|
+
|
|
|
+ if (record.arg === ContinueSentinel) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ value: record.arg,
|
|
|
+ done: context.done
|
|
|
+ };
|
|
|
+
|
|
|
+ } else if (record.type === "throw") {
|
|
|
+ state = GenStateCompleted;
|
|
|
+ context.method = "throw";
|
|
|
+ context.arg = record.arg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ function maybeInvokeDelegate(delegate, context) {
|
|
|
+ var method = delegate.iterator[context.method];
|
|
|
+ if (method === undefined) {
|
|
|
+ context.delegate = null;
|
|
|
+
|
|
|
+ if (context.method === "throw") {
|
|
|
+ if (delegate.iterator.return) {
|
|
|
+ context.method = "return";
|
|
|
+ context.arg = undefined;
|
|
|
+ maybeInvokeDelegate(delegate, context);
|
|
|
+
|
|
|
+ if (context.method === "throw") {
|
|
|
+ return ContinueSentinel;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ context.method = "throw";
|
|
|
+ context.arg = new TypeError(
|
|
|
+ "The iterator does not provide a 'throw' method");
|
|
|
+ }
|
|
|
+
|
|
|
+ return ContinueSentinel;
|
|
|
+ }
|
|
|
+
|
|
|
+ var record = tryCatch(method, delegate.iterator, context.arg);
|
|
|
+
|
|
|
+ if (record.type === "throw") {
|
|
|
+ context.method = "throw";
|
|
|
+ context.arg = record.arg;
|
|
|
+ context.delegate = null;
|
|
|
+ return ContinueSentinel;
|
|
|
+ }
|
|
|
+
|
|
|
+ var info = record.arg;
|
|
|
+
|
|
|
+ if (! info) {
|
|
|
+ context.method = "throw";
|
|
|
+ context.arg = new TypeError("iterator result is not an object");
|
|
|
+ context.delegate = null;
|
|
|
+ return ContinueSentinel;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (info.done) {
|
|
|
+ context[delegate.resultName] = info.value;
|
|
|
+
|
|
|
+ context.next = delegate.nextLoc;
|
|
|
+
|
|
|
+ if (context.method !== "return") {
|
|
|
+ context.method = "next";
|
|
|
+ context.arg = undefined;
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // Re-yield the result returned by the delegate method.
|
|
|
+ return info;
|
|
|
+ }
|
|
|
+
|
|
|
+ // The delegate iterator is finished, so forget it and continue with
|
|
|
+ // the outer generator.
|
|
|
+ context.delegate = null;
|
|
|
+ return ContinueSentinel;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Define Generator.prototype.{next,throw,return} in terms of the
|
|
|
+ // unified ._invoke helper method.
|
|
|
+ defineIteratorMethods(Gp);
|
|
|
+
|
|
|
+ Gp[toStringTagSymbol] = "Generator";
|
|
|
+ Gp[iteratorSymbol] = function() {
|
|
|
+ return this;
|
|
|
+ };
|
|
|
+
|
|
|
+ Gp.toString = function() {
|
|
|
+ return "[object Generator]";
|
|
|
+ };
|
|
|
+
|
|
|
+ function pushTryEntry(locs) {
|
|
|
+ var entry = { tryLoc: locs[0] };
|
|
|
+
|
|
|
+ if (1 in locs) {
|
|
|
+ entry.catchLoc = locs[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (2 in locs) {
|
|
|
+ entry.finallyLoc = locs[2];
|
|
|
+ entry.afterLoc = locs[3];
|
|
|
+ }
|
|
|
+
|
|
|
+ this.tryEntries.push(entry);
|
|
|
+ }
|
|
|
+
|
|
|
+ function resetTryEntry(entry) {
|
|
|
+ var record = entry.completion || {};
|
|
|
+ record.type = "normal";
|
|
|
+ delete record.arg;
|
|
|
+ entry.completion = record;
|
|
|
+ }
|
|
|
+
|
|
|
+ function Context(tryLocsList) {
|
|
|
+ this.tryEntries = [{ tryLoc: "root" }];
|
|
|
+ tryLocsList.forEach(pushTryEntry, this);
|
|
|
+ this.reset(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ exports.keys = function(object) {
|
|
|
+ var keys = [];
|
|
|
+ for (var key in object) {
|
|
|
+ keys.push(key);
|
|
|
+ }
|
|
|
+ keys.reverse();
|
|
|
+ return function next() {
|
|
|
+ while (keys.length) {
|
|
|
+ var key = keys.pop();
|
|
|
+ if (key in object) {
|
|
|
+ next.value = key;
|
|
|
+ next.done = false;
|
|
|
+ return next;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ next.done = true;
|
|
|
+ return next;
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
+ function values(iterable) {
|
|
|
+ if (iterable) {
|
|
|
+ var iteratorMethod = iterable[iteratorSymbol];
|
|
|
+ if (iteratorMethod) {
|
|
|
+ return iteratorMethod.call(iterable);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeof iterable.next === "function") {
|
|
|
+ return iterable;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isNaN(iterable.length)) {
|
|
|
+ var i = -1, next = function next() {
|
|
|
+ while (++i < iterable.length) {
|
|
|
+ if (hasOwn.call(iterable, i)) {
|
|
|
+ next.value = iterable[i];
|
|
|
+ next.done = false;
|
|
|
+ return next;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ next.value = undefined;
|
|
|
+ next.done = true;
|
|
|
+
|
|
|
+ return next;
|
|
|
+ };
|
|
|
+
|
|
|
+ return next.next = next;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Return an iterator with no values.
|
|
|
+ return { next: doneResult };
|
|
|
+ }
|
|
|
+ exports.values = values;
|
|
|
+
|
|
|
+ function doneResult() {
|
|
|
+ return { value: undefined, done: true };
|
|
|
+ }
|
|
|
+
|
|
|
+ Context.prototype = {
|
|
|
+ constructor: Context,
|
|
|
+
|
|
|
+ reset: function(skipTempReset) {
|
|
|
+ this.prev = 0;
|
|
|
+ this.next = 0;
|
|
|
+ this.sent = this._sent = undefined;
|
|
|
+ this.done = false;
|
|
|
+ this.delegate = null;
|
|
|
+
|
|
|
+ this.method = "next";
|
|
|
+ this.arg = undefined;
|
|
|
+
|
|
|
+ this.tryEntries.forEach(resetTryEntry);
|
|
|
+
|
|
|
+ if (!skipTempReset) {
|
|
|
+ for (var name in this) {
|
|
|
+ // Not sure about the optimal order of these conditions:
|
|
|
+ if (name.charAt(0) === "t" &&
|
|
|
+ hasOwn.call(this, name) &&
|
|
|
+ !isNaN(+name.slice(1))) {
|
|
|
+ this[name] = undefined;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ stop: function() {
|
|
|
+ this.done = true;
|
|
|
+
|
|
|
+ var rootEntry = this.tryEntries[0];
|
|
|
+ var rootRecord = rootEntry.completion;
|
|
|
+ if (rootRecord.type === "throw") {
|
|
|
+ throw rootRecord.arg;
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.rval;
|
|
|
+ },
|
|
|
+
|
|
|
+ dispatchException: function(exception) {
|
|
|
+ if (this.done) {
|
|
|
+ throw exception;
|
|
|
+ }
|
|
|
+
|
|
|
+ var context = this;
|
|
|
+ function handle(loc, caught) {
|
|
|
+ record.type = "throw";
|
|
|
+ record.arg = exception;
|
|
|
+ context.next = loc;
|
|
|
+
|
|
|
+ if (caught) {
|
|
|
+ context.method = "next";
|
|
|
+ context.arg = undefined;
|
|
|
+ }
|
|
|
+
|
|
|
+ return !! caught;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
|
+ var entry = this.tryEntries[i];
|
|
|
+ var record = entry.completion;
|
|
|
+
|
|
|
+ if (entry.tryLoc === "root") {
|
|
|
+ return handle("end");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entry.tryLoc <= this.prev) {
|
|
|
+ var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
|
+ var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
|
+
|
|
|
+ if (hasCatch && hasFinally) {
|
|
|
+ if (this.prev < entry.catchLoc) {
|
|
|
+ return handle(entry.catchLoc, true);
|
|
|
+ } else if (this.prev < entry.finallyLoc) {
|
|
|
+ return handle(entry.finallyLoc);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (hasCatch) {
|
|
|
+ if (this.prev < entry.catchLoc) {
|
|
|
+ return handle(entry.catchLoc, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (hasFinally) {
|
|
|
+ if (this.prev < entry.finallyLoc) {
|
|
|
+ return handle(entry.finallyLoc);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ throw new Error("try statement without catch or finally");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ abrupt: function(type, arg) {
|
|
|
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
|
+ var entry = this.tryEntries[i];
|
|
|
+ if (entry.tryLoc <= this.prev &&
|
|
|
+ hasOwn.call(entry, "finallyLoc") &&
|
|
|
+ this.prev < entry.finallyLoc) {
|
|
|
+ var finallyEntry = entry;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (finallyEntry &&
|
|
|
+ (type === "break" ||
|
|
|
+ type === "continue") &&
|
|
|
+ finallyEntry.tryLoc <= arg &&
|
|
|
+ arg <= finallyEntry.finallyLoc) {
|
|
|
+ finallyEntry = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ var record = finallyEntry ? finallyEntry.completion : {};
|
|
|
+ record.type = type;
|
|
|
+ record.arg = arg;
|
|
|
+
|
|
|
+ if (finallyEntry) {
|
|
|
+ this.method = "next";
|
|
|
+ this.next = finallyEntry.finallyLoc;
|
|
|
+ return ContinueSentinel;
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.complete(record);
|
|
|
+ },
|
|
|
+
|
|
|
+ complete: function(record, afterLoc) {
|
|
|
+ if (record.type === "throw") {
|
|
|
+ throw record.arg;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (record.type === "break" ||
|
|
|
+ record.type === "continue") {
|
|
|
+ this.next = record.arg;
|
|
|
+ } else if (record.type === "return") {
|
|
|
+ this.rval = this.arg = record.arg;
|
|
|
+ this.method = "return";
|
|
|
+ this.next = "end";
|
|
|
+ } else if (record.type === "normal" && afterLoc) {
|
|
|
+ this.next = afterLoc;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ContinueSentinel;
|
|
|
+ },
|
|
|
+
|
|
|
+ finish: function(finallyLoc) {
|
|
|
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
|
+ var entry = this.tryEntries[i];
|
|
|
+ if (entry.finallyLoc === finallyLoc) {
|
|
|
+ this.complete(entry.completion, entry.afterLoc);
|
|
|
+ resetTryEntry(entry);
|
|
|
+ return ContinueSentinel;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ "catch": function(tryLoc) {
|
|
|
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
|
+ var entry = this.tryEntries[i];
|
|
|
+ if (entry.tryLoc === tryLoc) {
|
|
|
+ var record = entry.completion;
|
|
|
+ if (record.type === "throw") {
|
|
|
+ var thrown = record.arg;
|
|
|
+ resetTryEntry(entry);
|
|
|
+ }
|
|
|
+ return thrown;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ throw new Error("illegal catch attempt");
|
|
|
+ },
|
|
|
+
|
|
|
+ delegateYield: function(iterable, resultName, nextLoc) {
|
|
|
+ this.delegate = {
|
|
|
+ iterator: values(iterable),
|
|
|
+ resultName: resultName,
|
|
|
+ nextLoc: nextLoc
|
|
|
+ };
|
|
|
+
|
|
|
+ if (this.method === "next") {
|
|
|
+ // Deliberately forget the last sent value so that we don't
|
|
|
+ // accidentally pass it on to the delegate.
|
|
|
+ this.arg = undefined;
|
|
|
+ }
|
|
|
+
|
|
|
+ return ContinueSentinel;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ return exports;
|
|
|
+
|
|
|
+}(
|
|
|
+ typeof module === "object" ? module.exports : {}
|
|
|
+));
|