From 9ebff18548641326da5b0883e43506ee3549240d Mon Sep 17 00:00:00 2001 From: Frederik Bosch Date: Wed, 13 Sep 2023 19:27:27 +0200 Subject: [PATCH] upgrade async await expectation --- test/expectations/es-next/async-await.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/expectations/es-next/async-await.js b/test/expectations/es-next/async-await.js index 89043e7..40897af 100644 --- a/test/expectations/es-next/async-await.js +++ b/test/expectations/es-next/async-await.js @@ -5,17 +5,15 @@ define("es-next/async-await", ["exports"], function (_exports) { value: true }); _exports.default = void 0; + var _ref; function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - let asyncFunc = /*#__PURE__*/function () { - var _ref = _asyncToGenerator(function* () { + let asyncFunc = function asyncFunc() { + return (_ref = _ref || _asyncToGenerator(function* () { let result = yield Promise.resolve(); return Promise.resolve(); - }); - return function asyncFunc() { - return _ref.apply(this, arguments); - }; - }(); + })).apply(this, arguments); + }; function syncFunc() { return Promise.all([asyncFunc()]); }