From 23d2dc0b2dc8384df23abdc69429e244906188a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 22 Sep 2020 15:20:33 +0900 Subject: [PATCH] Fix #1036 --- .../src/compat/es2015/block_scoping.rs | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/ecmascript/transforms/src/compat/es2015/block_scoping.rs b/ecmascript/transforms/src/compat/es2015/block_scoping.rs index 22d0c49a4f15..afd7256a4db9 100644 --- a/ecmascript/transforms/src/compat/es2015/block_scoping.rs +++ b/ecmascript/transforms/src/compat/es2015/block_scoping.rs @@ -1440,9 +1440,54 @@ expect(foo()).toBe(false); ) } ", - " - - " + r#" + var regeneratorRuntime = require("regenerator-runtime"); + var _marked = regeneratorRuntime.mark(_foo); + function _foo() { + _foo = _asyncToGenerator(regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_ctx) { + while(1)switch(_ctx.prev = _ctx.next){ + case 0: + _ctx.next = 2; + return Promise.all([ + [ + 1 + ], + [ + 2 + ], + [ + 3 + ] + ].map(_asyncToGenerator(regeneratorRuntime.mark(function _callee1(param) { + var _param = _slicedToArray(param, 1), a = _param[0]; + return regeneratorRuntime.wrap(function _callee$1(_ctx1) { + while(1)switch(_ctx1.prev = _ctx1.next){ + case 0: + return _ctx1.abrupt("return", Promise.resolve().then(function() { + return a * 2; + })); + case 1: + case "end": + return _ctx1.stop(); + } + }, _callee1); + })))); + case 2: + _ctx.sent; + case 3: + case "end": + return _ctx.stop(); + } + }, _callee); + })); + return _foo.apply(this, arguments); + } + function foo() { + return _foo.apply(this, arguments); + } + + "# ); test_exec!(