Skip to content

Commit 6782b7c

Browse files
committed
fix
1 parent 8f50130 commit 6782b7c

File tree

14 files changed

+254
-13
lines changed

14 files changed

+254
-13
lines changed

packages/babel-helpers/src/helpers-generated.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1075,10 +1075,10 @@ const helpers: Record<string, Helper> = {
10751075
internal: false,
10761076
},
10771077
),
1078-
// size: 2447, gzip size: 1164
1078+
// size: 2451, gzip size: 1166
10791079
regenerator: helper(
10801080
"7.27.0",
1081-
'function _regenerator(){\n/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */\nvar e,t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag",u=["next","throw","return"];function c(r,n,o,i){var a=n&&n.prototype instanceof Generator?n:Generator,c=Object.create(a.prototype);return define(c,"_invoke",function(r,n,o){var i,a,c,p=0,y=o||[],d=!1,l={prev:0,next:0,sent:e,abrupt:s,finish:s.bind(e,4),delegateYield:(t,r)=>(i=values(t),a=0,c=e,l.next=r,f)};function s(r,n){for(a=r,c=n,t=0;!d&&p&&!o&&t<y.length;t++){var o,i=y[t],u=l.prev,s=i[2];r>3?(o=s===n)&&(a=i[4]||3,c=i[5]===e?i[3]:i[5],i[4]=3,i[5]=e):i[0]<=u&&((o=r<2&&u<i[1])?(a=0,l.sent=n,l.next=i[1]):u<s&&(o=r<3||i[0]>n||n>s)&&(i[4]=r,i[5]=n,l.next=s,a=0))}if(o||r>1)return f;throw d=!0,n}return function(o,y,G){if(2===p)throw Error("Generator is already running");for(d&&1===y&&s(y,G),a=y,c=G;!d||(t=e);){i||(a?a<3?(a>1&&(l.next=-1),s(a,c)):l.next=c:l.sent=c);try{if(i){if(t=i[u[a]]){if(t=t.call(i,c)){if(!t)throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}}else a&&(t=i[u[2]])&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a \'"+u[a]+"\' method"),a=1);i=e}else if(p=2,t=(d=l.next<0)?c:r.call(n,l),p=d?3:1,t!==f)break}catch(t){p=3,i=e,a=1,c=t}}return{value:t,done:d}}}(r,o,i),!0),c}var f={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,i,(function(){return this}));var y=Object.getPrototypeOf,d=y&&y(y(values([])));d&&d!==r&&n.call(d,i)&&(p=d);var l=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function s(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,a,"GeneratorFunction")),e.prototype=Object.create(l),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(l,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,a,"GeneratorFunction"),defineIteratorMethods(l),define(l,a,"Generator"),define(l,i,(function(){return this})),define(l,"toString",(function(){return"[object Generator]"})),(_regenerator=function(){return{w:c,m:s}})()}',
1081+
'function _regenerator(){\n/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */\nvar e,t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.toStringTag||"@@toStringTag",u=["next","throw","return"];function c(r,n,o,i){var a=n&&n.prototype instanceof Generator?n:Generator,c=Object.create(a.prototype);return define(c,"_invoke",function(r,n,o){var i,a,c,p=0,y=o||[],d=!1,l={prev:0,next:0,sent:e,abrupt:s,finish:s.bind(e,4),delegateYield:(t,r)=>(i=values(t),a=0,c=e,l.next=r,f)};function s(r,n){for(a=r,c=n,t=0;!d&&p&&!o&&t<y.length;t++){var o,i=y[t],u=l.prev,s=i[2];r>3?(o=s===n)&&(a=i[4]||3,c=i[5]===e?i[3]:i[5],i[4]=3,i[5]=e):i[0]<=u&&((o=r<2&&u<i[1])?(a=0,l.sent=n,l.next=i[1]):u<s&&(o=r<3||i[0]>n||n>s)&&(i[4]=r,i[5]=n,l.next=s,a=0))}if(o||r>1)return f;throw d=!0,n}return function(o,y,G){if(2===p)throw Error("Generator is already running");for(d&&1===y&&s(y,G),a=y,c=G;!d||(t=e);){i||(a?a<3?(a>1&&(l.next=-1),s(a,c)):l.next=c:l.sent=c);try{if(i){if(t=i[u[a]]){if(t=t.call(i,c)){if(!t)throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}}else 1===a&&(t=i[u[2]])&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a \'"+u[a]+"\' method"),a=1);i=e}else if(p=2,t=(d=l.next<0)?c:r.call(n,l),p=d?3:1,t!==f)break}catch(t){p=3,i=e,a=1,c=t}}return{value:t,done:d}}}(r,o,i),!0),c}var f={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,i,(function(){return this}));var y=Object.getPrototypeOf,d=y&&y(y(values([])));d&&d!==r&&n.call(d,i)&&(p=d);var l=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function s(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,a,"GeneratorFunction")),e.prototype=Object.create(l),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(l,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,a,"GeneratorFunction"),defineIteratorMethods(l),define(l,a,"Generator"),define(l,i,(function(){return this})),define(l,"toString",(function(){return"[object Generator]"})),(_regenerator=function(){return{w:c,m:s}})()}',
10821082
{
10831083
globals: ["Object", "Symbol", "Error", "TypeError"],
10841084
locals: {

packages/babel-helpers/src/helpers/regenerator.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,14 @@ export default function /* @no-mangle */ _regenerator() {
234234
} else {
235235
// Note: ["return"] must be used for ES3 parsing compatibility.
236236
if (
237-
method /* Throw | Return */ &&
237+
method === OperatorType.Throw &&
238238
(_ = delegateIterator[FunctionNameStrings[OperatorType.Return]])
239239
) {
240240
// If the delegate iterator has a return method, give it a
241241
// chance to clean up.
242242
_.call(delegateIterator);
243243
}
244244

245-
// method === OperatorType.Throw
246245
if (method < 2 /* Next | Throw */) {
247246
arg = TypeError(
248247
"The iterator does not provide a '" +

packages/babel-plugin-transform-async-generator-functions/test/fixtures/regression/13801-babel-7/output.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function _regeneratorAsyncIterator(t, e) { function r(n, o, i, f) { var a = _try
44
function _tryCatch(t, r, e) { try { return { e: 0, v: t.call(r, e) }; } catch (t) { return { e: 1, v: t }; } }
55
function _awaitAsyncGenerator(e) { return new _OverloadYield(e, 0); }
66
function _OverloadYield(e, d) { this.v = e, this.k = d; }
7-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = Object.prototype, n = r.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.toStringTag || "@@toStringTag", u = ["next", "throw", "return"]; function c(r, n, o, i) { var a = n && n.prototype instanceof Generator ? n : Generator, c = Object.create(a.prototype); return _regeneratorDefine(c, "_invoke", function (r, n, o) { var i, a, c, p = 0, y = o || [], d = !1, l = { prev: 0, next: 0, sent: e, abrupt: s, finish: s.bind(e, 4), delegateYield: (t, r) => (i = _regeneratorValues(t), a = 0, c = e, l.next = r, f) }; function s(r, n) { for (a = r, c = n, t = 0; !d && p && !o && t < y.length; t++) { var o, i = y[t], u = l.prev, s = i[2]; r > 3 ? (o = s === n) && (a = i[4] || 3, c = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= u && ((o = r < 2 && u < i[1]) ? (a = 0, l.sent = n, l.next = i[1]) : u < s && (o = r < 3 || i[0] > n || n > s) && (i[4] = r, i[5] = n, l.next = s, a = 0)); } if (o || r > 1) return f; throw d = !0, n; } return function (o, y, G) { if (2 === p) throw Error("Generator is already running"); for (d && 1 === y && s(y, G), a = y, c = G; !d || (t = e);) { i || (a ? a < 3 ? (a > 1 && (l.next = -1), s(a, c)) : l.next = c : l.sent = c); try { if (i) { if (t = i[u[a]]) { if (t = t.call(i, c)) { if (!t) throw TypeError("iterator result is not an object"); if (!t.done) return t; c = t.value, a < 2 && (a = 0); } } else a && (t = i[u[2]]) && t.call(i), a < 2 && (c = TypeError("The iterator does not provide a '" + u[a] + "' method"), a = 1); i = e; } else if (p = 2, t = (d = l.next < 0) ? c : r.call(n, l), p = d ? 3 : 1, t !== f) break; } catch (t) { p = 3, i = e, a = 1, c = t; } } return { value: t, done: d }; }; }(r, o, i), !0), c; } var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; _regeneratorDefine(p, i, function () { return this; }); var y = Object.getPrototypeOf, d = y && y(y(_regeneratorValues([]))); d && d !== r && n.call(d, i) && (p = d); var l = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function s(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, a, "GeneratorFunction")), e.prototype = Object.create(l), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(l, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = _regeneratorDefine(GeneratorFunctionPrototype, a, "GeneratorFunction"), _regeneratorDefineIM(l), _regeneratorDefine(l, a, "Generator"), _regeneratorDefine(l, i, function () { return this; }), _regeneratorDefine(l, "toString", function () { return "[object Generator]"; }), (_regenerator = function () { return { w: c, m: s }; })(); }
7+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = Object.prototype, n = r.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.toStringTag || "@@toStringTag", u = ["next", "throw", "return"]; function c(r, n, o, i) { var a = n && n.prototype instanceof Generator ? n : Generator, c = Object.create(a.prototype); return _regeneratorDefine(c, "_invoke", function (r, n, o) { var i, a, c, p = 0, y = o || [], d = !1, l = { prev: 0, next: 0, sent: e, abrupt: s, finish: s.bind(e, 4), delegateYield: (t, r) => (i = _regeneratorValues(t), a = 0, c = e, l.next = r, f) }; function s(r, n) { for (a = r, c = n, t = 0; !d && p && !o && t < y.length; t++) { var o, i = y[t], u = l.prev, s = i[2]; r > 3 ? (o = s === n) && (a = i[4] || 3, c = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= u && ((o = r < 2 && u < i[1]) ? (a = 0, l.sent = n, l.next = i[1]) : u < s && (o = r < 3 || i[0] > n || n > s) && (i[4] = r, i[5] = n, l.next = s, a = 0)); } if (o || r > 1) return f; throw d = !0, n; } return function (o, y, G) { if (2 === p) throw Error("Generator is already running"); for (d && 1 === y && s(y, G), a = y, c = G; !d || (t = e);) { i || (a ? a < 3 ? (a > 1 && (l.next = -1), s(a, c)) : l.next = c : l.sent = c); try { if (i) { if (t = i[u[a]]) { if (t = t.call(i, c)) { if (!t) throw TypeError("iterator result is not an object"); if (!t.done) return t; c = t.value, a < 2 && (a = 0); } } else 1 === a && (t = i[u[2]]) && t.call(i), a < 2 && (c = TypeError("The iterator does not provide a '" + u[a] + "' method"), a = 1); i = e; } else if (p = 2, t = (d = l.next < 0) ? c : r.call(n, l), p = d ? 3 : 1, t !== f) break; } catch (t) { p = 3, i = e, a = 1, c = t; } } return { value: t, done: d }; }; }(r, o, i), !0), c; } var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; _regeneratorDefine(p, i, function () { return this; }); var y = Object.getPrototypeOf, d = y && y(y(_regeneratorValues([]))); d && d !== r && n.call(d, i) && (p = d); var l = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function s(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, a, "GeneratorFunction")), e.prototype = Object.create(l), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(l, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = _regeneratorDefine(GeneratorFunctionPrototype, a, "GeneratorFunction"), _regeneratorDefineIM(l), _regeneratorDefine(l, a, "Generator"), _regeneratorDefine(l, i, function () { return this; }), _regeneratorDefine(l, "toString", function () { return "[object Generator]"; }), (_regenerator = function () { return { w: c, m: s }; })(); }
88
function _regeneratorValues(e) { if (null != e) { var r = e["function" == typeof Symbol && Symbol.iterator || "@iterator"]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var t = -1, n = function r() { for (; ++t < e.length;) if ({}.hasOwnProperty.call(e, t)) return r.value = e[t], r.done = !1, r; return r.value = void 0, r.done = !0, r; }; return n.next = n; } } throw new TypeError(typeof e + " is not iterable"); }
99
function _regeneratorDefineIM(e) { function n(n, t) { _regeneratorDefine(e, n, function (e) { return this._invoke(n, t, e); }); } n("next", 0), n("throw", 1), n("return", 2); }
1010
function _regeneratorDefine(e, r, n, t) { _regeneratorDefine = function (e, r, n, t) { return Object.defineProperty(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }); }; try { _regeneratorDefine({}, ""); } catch (e) { _regeneratorDefine = function (e, r, n) { return e[r] = n; }; } return _regeneratorDefine(e, r, n, t); }

0 commit comments

Comments
 (0)