fix(es/transforms/compat): Fix async_to_generator (#2526)

swc_ecma_transforms_compat:
 - `async_to_generator`: Handle `for-await` correctly. (#2306)
This commit is contained in:
Donny/강동윤 2021-10-25 14:37:13 +09:00 committed by GitHub
parent 709b3c7cd6
commit e7189fbdbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 127 additions and 61 deletions

2
Cargo.lock generated
View File

@ -2823,7 +2823,7 @@ dependencies = [
[[package]]
name = "swc_ecma_transforms_compat"
version = "0.47.0"
version = "0.47.1"
dependencies = [
"ahash",
"arrayvec",

View File

@ -6,7 +6,7 @@ edition = "2018"
license = "Apache-2.0/MIT"
name = "swc_ecma_transforms_compat"
repository = "https://github.com/swc-project/swc.git"
version = "0.47.0"
version = "0.47.1"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]

View File

@ -955,7 +955,7 @@ impl Fold for AsyncFnBodyHandler {
fn fold_stmt(&mut self, s: Stmt) -> Stmt {
let s = s.fold_children_with(self);
handle_await_for(s)
handle_await_for(s, self.is_async_generator)
}
}
@ -1024,7 +1024,7 @@ fn extract_callee_of_bind_this(n: &mut CallExpr) -> Option<&mut Expr> {
}
}
fn handle_await_for(stmt: Stmt) -> Stmt {
fn handle_await_for(stmt: Stmt, is_async_generator: bool) -> Stmt {
let s = match stmt {
Stmt::ForOf(
s @ ForOfStmt {
@ -1138,21 +1138,32 @@ fn handle_await_for(stmt: Stmt) -> Stmt {
})),
// _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done
test: {
let iter_next = iterator.clone().make_member(quote_ident!("next"));
let iter_next = CallExpr {
span: DUMMY_SP,
callee: iter_next.as_callee(),
args: Default::default(),
type_args: Default::default(),
};
let yield_arg = if is_async_generator {
Box::new(Expr::Call(CallExpr {
span: DUMMY_SP,
callee: helper!(await_async_generator, "awaitAsyncGenerator"),
args: vec![iter_next.as_arg()],
type_args: Default::default(),
}))
} else {
Box::new(Expr::Call(iter_next))
};
let assign_to_step = Expr::Assign(AssignExpr {
span: DUMMY_SP,
op: op!("="),
left: PatOrExpr::Pat(Box::new(Pat::Ident(step.clone().into()))),
right: Box::new(Expr::Yield(YieldExpr {
span: DUMMY_SP,
arg: Some(Box::new(Expr::Call(CallExpr {
span: DUMMY_SP,
callee: iterator
.clone()
.make_member(quote_ident!("next"))
.as_callee(),
args: Default::default(),
type_args: Default::default(),
}))),
arg: Some(yield_arg),
delegate: false,
})),
});

View File

@ -0,0 +1,19 @@
async function* g1() {
yield "OK";
yield "OK";
yield "OK";
}
async function* g2() {
for await (const g of g1()) {
console.log('g2:', g);
yield g;
}
}
(async () => {
for await (const g of g2()) {
console.log('main:', g);
}
})();

View File

@ -122,6 +122,9 @@ function _asyncToGenerator(fn) {
});
};
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -203,7 +206,7 @@ function _f3() {
{
var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError;
try {
for(var _iterator = _asyncIterator(y), _step; _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = false){
for(var _iterator = _asyncIterator(y), _step; _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = false){
let _value = _step.value;
const x = _value;
}
@ -235,7 +238,7 @@ function _f4() {
{
var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError;
try {
for(var _iterator = _asyncIterator(y), _step; _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = false){
for(var _iterator = _asyncIterator(y), _step; _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = false){
let _value = _step.value;
x = _value;
}
@ -302,7 +305,7 @@ function _f6() {
outer: {
var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError;
try {
for(var _iterator = _asyncIterator(y), _step; _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = false){
for(var _iterator = _asyncIterator(y), _step; _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = false){
let _value = _step.value;
const x = _value;
continue outer;
@ -337,7 +340,7 @@ function _f7() {
{
var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError;
try {
for(var _iterator = _asyncIterator(y), _step; _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = false){
for(var _iterator = _asyncIterator(y), _step; _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = false){
let _value = _step.value;
const x = _value;
}

View File

@ -81,6 +81,9 @@ function _asyncToGenerator(fn) {
});
};
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -128,7 +131,7 @@ function _f3() {
let y;
var _iteratorError, _iteratorAbruptCompletion = !1, _didIteratorError = !1;
try {
for(var _step, _iterator = _asyncIterator(y); _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = !1);
for(var _step, _iterator = _asyncIterator(y); _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = !1);
} catch (err) {
_didIteratorError = !0, _iteratorError = err;
} finally{
@ -145,7 +148,7 @@ function _f4() {
let y;
var _iteratorError, _iteratorAbruptCompletion = !1, _didIteratorError = !1;
try {
for(var _step, _iterator = _asyncIterator(y); _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = !1);
for(var _step, _iterator = _asyncIterator(y); _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = !1);
} catch (err) {
_didIteratorError = !0, _iteratorError = err;
} finally{
@ -185,7 +188,7 @@ function _f6() {
outer: {
var _iteratorError, _iteratorAbruptCompletion = !1, _didIteratorError = !1;
try {
for(var _step, _iterator = _asyncIterator(y); _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = !1){
for(var _step, _iterator = _asyncIterator(y); _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = !1){
_step.value;
continue outer;
}
@ -207,7 +210,7 @@ function _f7() {
for(;;){
var _iteratorError, _iteratorAbruptCompletion = !1, _didIteratorError = !1;
try {
for(var _step, _iterator = _asyncIterator(y); _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = !1);
for(var _step, _iterator = _asyncIterator(y); _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = !1);
} catch (err) {
_didIteratorError = !0, _iteratorError = err;
} finally{

View File

@ -123,6 +123,9 @@ function _asyncToGenerator(fn) {
});
};
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -304,7 +307,7 @@ function _f3() {
_iterator = _asyncIterator(y);
case 4:
_ctx.next = 6;
return _iterator.next();
return _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;
@ -383,7 +386,7 @@ function _f4() {
_iterator = _asyncIterator(y);
case 4:
_ctx.next = 6;
return _iterator.next();
return _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;
@ -542,7 +545,7 @@ function _f6() {
_iterator = _asyncIterator(y);
case 4:
_ctx.next = 6;
return _iterator.next();
return _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 13;
@ -622,7 +625,7 @@ function _f7() {
_iterator = _asyncIterator(y);
case 4:
_ctx.next = 6;
return _iterator.next();
return _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;

View File

@ -82,6 +82,9 @@ function _asyncToGenerator(fn) {
});
};
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -216,7 +219,7 @@ function _f3() {
case 0:
_iteratorAbruptCompletion = !1, _didIteratorError = !1, _ctx.prev = 2, _iterator = _asyncIterator(y);
case 4:
return _ctx.next = 6, _iterator.next();
return _ctx.next = 6, _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;
@ -275,7 +278,7 @@ function _f4() {
case 0:
_iteratorAbruptCompletion = !1, _didIteratorError = !1, _ctx.prev = 2, _iterator = _asyncIterator(y);
case 4:
return _ctx.next = 6, _iterator.next();
return _ctx.next = 6, _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;
@ -393,7 +396,7 @@ function _f6() {
case 0:
_iteratorAbruptCompletion = !1, _didIteratorError = !1, _ctx.prev = 2, _iterator = _asyncIterator(y);
case 4:
return _ctx.next = 6, _iterator.next();
return _ctx.next = 6, _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 13;
@ -453,7 +456,7 @@ function _f7() {
case 1:
_iteratorAbruptCompletion = !1, _didIteratorError = !1, _ctx.prev = 2, _iterator = _asyncIterator(y);
case 4:
return _ctx.next = 6, _iterator.next();
return _ctx.next = 6, _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;

View File

@ -122,6 +122,9 @@ function _asyncToGenerator(fn) {
});
};
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -277,7 +280,7 @@ function _f2() {
{
var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError;
try {
for(var _iterator = _asyncIterator(asyncIterable), _step; _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = false){
for(var _iterator = _asyncIterator(asyncIterable), _step; _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = false){
let _value = _step.value;
const x = _value;
}
@ -299,7 +302,7 @@ function _f2() {
{
var _iteratorAbruptCompletion6 = false, _didIteratorError6 = false, _iteratorError6;
try {
for(var _iterator6 = _asyncIterator(iterable), _step6; _iteratorAbruptCompletion6 = !(_step6 = yield _iterator6.next()).done; _iteratorAbruptCompletion6 = false){
for(var _iterator6 = _asyncIterator(iterable), _step6; _iteratorAbruptCompletion6 = !(_step6 = yield _awaitAsyncGenerator(_iterator6.next())).done; _iteratorAbruptCompletion6 = false){
let _value = _step6.value;
const x = _value;
}
@ -321,7 +324,7 @@ function _f2() {
{
var _iteratorAbruptCompletion7 = false, _didIteratorError7 = false, _iteratorError7;
try {
for(var _iterator7 = _asyncIterator(iterableOfPromise), _step7; _iteratorAbruptCompletion7 = !(_step7 = yield _iterator7.next()).done; _iteratorAbruptCompletion7 = false){
for(var _iterator7 = _asyncIterator(iterableOfPromise), _step7; _iteratorAbruptCompletion7 = !(_step7 = yield _awaitAsyncGenerator(_iterator7.next())).done; _iteratorAbruptCompletion7 = false){
let _value = _step7.value;
const x = _value;
}
@ -343,7 +346,7 @@ function _f2() {
{
var _iteratorAbruptCompletion8 = false, _didIteratorError8 = false, _iteratorError8;
try {
for(var _iterator8 = _asyncIterator(asyncIterable), _step8; _iteratorAbruptCompletion8 = !(_step8 = yield _iterator8.next()).done; _iteratorAbruptCompletion8 = false){
for(var _iterator8 = _asyncIterator(asyncIterable), _step8; _iteratorAbruptCompletion8 = !(_step8 = yield _awaitAsyncGenerator(_iterator8.next())).done; _iteratorAbruptCompletion8 = false){
let _value = _step8.value;
y = _value;
}
@ -365,7 +368,7 @@ function _f2() {
{
var _iteratorAbruptCompletion9 = false, _didIteratorError9 = false, _iteratorError9;
try {
for(var _iterator9 = _asyncIterator(iterable), _step9; _iteratorAbruptCompletion9 = !(_step9 = yield _iterator9.next()).done; _iteratorAbruptCompletion9 = false){
for(var _iterator9 = _asyncIterator(iterable), _step9; _iteratorAbruptCompletion9 = !(_step9 = yield _awaitAsyncGenerator(_iterator9.next())).done; _iteratorAbruptCompletion9 = false){
let _value = _step9.value;
y = _value;
}
@ -387,7 +390,7 @@ function _f2() {
{
var _iteratorAbruptCompletion10 = false, _didIteratorError10 = false, _iteratorError10;
try {
for(var _iterator10 = _asyncIterator(iterableOfPromise), _step10; _iteratorAbruptCompletion10 = !(_step10 = yield _iterator10.next()).done; _iteratorAbruptCompletion10 = false){
for(var _iterator10 = _asyncIterator(iterableOfPromise), _step10; _iteratorAbruptCompletion10 = !(_step10 = yield _awaitAsyncGenerator(_iterator10.next())).done; _iteratorAbruptCompletion10 = false){
let _value = _step10.value;
y = _value;
}

View File

@ -66,6 +66,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
}
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -167,7 +170,7 @@ function _f2() {
})(function*() {
var _iteratorError, _iteratorAbruptCompletion = !1, _didIteratorError = !1;
try {
for(var _step, _iterator = _asyncIterator(asyncIterable); _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = !1);
for(var _step, _iterator = _asyncIterator(asyncIterable); _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = !1);
} catch (err) {
_didIteratorError = !0, _iteratorError = err;
} finally{
@ -179,7 +182,7 @@ function _f2() {
}
var _iteratorError6, _iteratorAbruptCompletion6 = !1, _didIteratorError6 = !1;
try {
for(var _step6, _iterator6 = _asyncIterator(iterable); _iteratorAbruptCompletion6 = !(_step6 = yield _iterator6.next()).done; _iteratorAbruptCompletion6 = !1);
for(var _step6, _iterator6 = _asyncIterator(iterable); _iteratorAbruptCompletion6 = !(_step6 = yield _awaitAsyncGenerator(_iterator6.next())).done; _iteratorAbruptCompletion6 = !1);
} catch (err6) {
_didIteratorError6 = !0, _iteratorError6 = err6;
} finally{
@ -191,7 +194,7 @@ function _f2() {
}
var _iteratorError7, _iteratorAbruptCompletion7 = !1, _didIteratorError7 = !1;
try {
for(var _step7, _iterator7 = _asyncIterator(iterableOfPromise); _iteratorAbruptCompletion7 = !(_step7 = yield _iterator7.next()).done; _iteratorAbruptCompletion7 = !1);
for(var _step7, _iterator7 = _asyncIterator(iterableOfPromise); _iteratorAbruptCompletion7 = !(_step7 = yield _awaitAsyncGenerator(_iterator7.next())).done; _iteratorAbruptCompletion7 = !1);
} catch (err7) {
_didIteratorError7 = !0, _iteratorError7 = err7;
} finally{
@ -203,7 +206,7 @@ function _f2() {
}
var _iteratorError8, _iteratorAbruptCompletion8 = !1, _didIteratorError8 = !1;
try {
for(var _step8, _iterator8 = _asyncIterator(asyncIterable); _iteratorAbruptCompletion8 = !(_step8 = yield _iterator8.next()).done; _iteratorAbruptCompletion8 = !1);
for(var _step8, _iterator8 = _asyncIterator(asyncIterable); _iteratorAbruptCompletion8 = !(_step8 = yield _awaitAsyncGenerator(_iterator8.next())).done; _iteratorAbruptCompletion8 = !1);
} catch (err8) {
_didIteratorError8 = !0, _iteratorError8 = err8;
} finally{
@ -215,7 +218,7 @@ function _f2() {
}
var _iteratorError9, _iteratorAbruptCompletion9 = !1, _didIteratorError9 = !1;
try {
for(var _step9, _iterator9 = _asyncIterator(iterable); _iteratorAbruptCompletion9 = !(_step9 = yield _iterator9.next()).done; _iteratorAbruptCompletion9 = !1);
for(var _step9, _iterator9 = _asyncIterator(iterable); _iteratorAbruptCompletion9 = !(_step9 = yield _awaitAsyncGenerator(_iterator9.next())).done; _iteratorAbruptCompletion9 = !1);
} catch (err9) {
_didIteratorError9 = !0, _iteratorError9 = err9;
} finally{
@ -227,7 +230,7 @@ function _f2() {
}
var _iteratorError10, _iteratorAbruptCompletion10 = !1, _didIteratorError10 = !1;
try {
for(var _step10, _iterator10 = _asyncIterator(iterableOfPromise); _iteratorAbruptCompletion10 = !(_step10 = yield _iterator10.next()).done; _iteratorAbruptCompletion10 = !1);
for(var _step10, _iterator10 = _asyncIterator(iterableOfPromise); _iteratorAbruptCompletion10 = !(_step10 = yield _awaitAsyncGenerator(_iterator10.next())).done; _iteratorAbruptCompletion10 = !1);
} catch (err10) {
_didIteratorError10 = !0, _iteratorError10 = err10;
} finally{

View File

@ -123,6 +123,9 @@ function _asyncToGenerator(fn) {
});
};
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -521,7 +524,7 @@ function _f2() {
_iterator = _asyncIterator(asyncIterable);
case 4:
_ctx.next = 6;
return _iterator.next();
return _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;
@ -569,7 +572,7 @@ function _f2() {
_iterator6 = _asyncIterator(iterable);
case 30:
_ctx.next = 32;
return _iterator6.next();
return _awaitAsyncGenerator(_iterator6.next());
case 32:
if (!(_iteratorAbruptCompletion6 = !(_step6 = _ctx.sent).done)) {
_ctx.next = 37;
@ -617,7 +620,7 @@ function _f2() {
_iterator7 = _asyncIterator(iterableOfPromise);
case 56:
_ctx.next = 58;
return _iterator7.next();
return _awaitAsyncGenerator(_iterator7.next());
case 58:
if (!(_iteratorAbruptCompletion7 = !(_step7 = _ctx.sent).done)) {
_ctx.next = 63;
@ -665,7 +668,7 @@ function _f2() {
_iterator8 = _asyncIterator(asyncIterable);
case 82:
_ctx.next = 84;
return _iterator8.next();
return _awaitAsyncGenerator(_iterator8.next());
case 84:
if (!(_iteratorAbruptCompletion8 = !(_step8 = _ctx.sent).done)) {
_ctx.next = 89;
@ -713,7 +716,7 @@ function _f2() {
_iterator9 = _asyncIterator(iterable);
case 108:
_ctx.next = 110;
return _iterator9.next();
return _awaitAsyncGenerator(_iterator9.next());
case 110:
if (!(_iteratorAbruptCompletion9 = !(_step9 = _ctx.sent).done)) {
_ctx.next = 115;
@ -761,7 +764,7 @@ function _f2() {
_iterator10 = _asyncIterator(iterableOfPromise);
case 134:
_ctx.next = 136;
return _iterator10.next();
return _awaitAsyncGenerator(_iterator10.next());
case 136:
if (!(_iteratorAbruptCompletion10 = !(_step10 = _ctx.sent).done)) {
_ctx.next = 141;

View File

@ -67,6 +67,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
}
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -385,7 +388,7 @@ function _f2() {
case 0:
_iteratorAbruptCompletion = !1, _didIteratorError = !1, _ctx.prev = 2, _iterator = _asyncIterator(asyncIterable);
case 4:
return _ctx.next = 6, _iterator.next();
return _ctx.next = 6, _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;
@ -419,7 +422,7 @@ function _f2() {
case 27:
_iteratorAbruptCompletion6 = !1, _didIteratorError6 = !1, _ctx.prev = 28, _iterator6 = _asyncIterator(iterable);
case 30:
return _ctx.next = 32, _iterator6.next();
return _ctx.next = 32, _awaitAsyncGenerator(_iterator6.next());
case 32:
if (!(_iteratorAbruptCompletion6 = !(_step6 = _ctx.sent).done)) {
_ctx.next = 37;
@ -453,7 +456,7 @@ function _f2() {
case 53:
_iteratorAbruptCompletion7 = !1, _didIteratorError7 = !1, _ctx.prev = 54, _iterator7 = _asyncIterator(iterableOfPromise);
case 56:
return _ctx.next = 58, _iterator7.next();
return _ctx.next = 58, _awaitAsyncGenerator(_iterator7.next());
case 58:
if (!(_iteratorAbruptCompletion7 = !(_step7 = _ctx.sent).done)) {
_ctx.next = 63;
@ -487,7 +490,7 @@ function _f2() {
case 79:
_iteratorAbruptCompletion8 = !1, _didIteratorError8 = !1, _ctx.prev = 80, _iterator8 = _asyncIterator(asyncIterable);
case 82:
return _ctx.next = 84, _iterator8.next();
return _ctx.next = 84, _awaitAsyncGenerator(_iterator8.next());
case 84:
if (!(_iteratorAbruptCompletion8 = !(_step8 = _ctx.sent).done)) {
_ctx.next = 89;
@ -521,7 +524,7 @@ function _f2() {
case 105:
_iteratorAbruptCompletion9 = !1, _didIteratorError9 = !1, _ctx.prev = 106, _iterator9 = _asyncIterator(iterable);
case 108:
return _ctx.next = 110, _iterator9.next();
return _ctx.next = 110, _awaitAsyncGenerator(_iterator9.next());
case 110:
if (!(_iteratorAbruptCompletion9 = !(_step9 = _ctx.sent).done)) {
_ctx.next = 115;
@ -555,7 +558,7 @@ function _f2() {
case 131:
_iteratorAbruptCompletion10 = !1, _didIteratorError10 = !1, _ctx.prev = 132, _iterator10 = _asyncIterator(iterableOfPromise);
case 134:
return _ctx.next = 136, _iterator10.next();
return _ctx.next = 136, _awaitAsyncGenerator(_iterator10.next());
case 136:
if (!(_iteratorAbruptCompletion10 = !(_step10 = _ctx.sent).done)) {
_ctx.next = 141;

View File

@ -122,6 +122,9 @@ function _asyncToGenerator(fn) {
});
};
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -195,7 +198,7 @@ function _f2() {
var _iteratorAbruptCompletion = false, _didIteratorError = false, _iteratorError;
try {
for(var _iterator = _asyncIterator({
}), _step; _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = false){
}), _step; _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = false){
let _value = _step.value;
const x = _value;
}
@ -218,7 +221,7 @@ function _f2() {
var _iteratorAbruptCompletion2 = false, _didIteratorError2 = false, _iteratorError2;
try {
for(var _iterator2 = _asyncIterator({
}), _step2; _iteratorAbruptCompletion2 = !(_step2 = yield _iterator2.next()).done; _iteratorAbruptCompletion2 = false){
}), _step2; _iteratorAbruptCompletion2 = !(_step2 = yield _awaitAsyncGenerator(_iterator2.next())).done; _iteratorAbruptCompletion2 = false){
let _value = _step2.value;
y = _value;
}

View File

@ -66,6 +66,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
}
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -122,7 +125,7 @@ function _f2() {
var _iteratorError, _iteratorAbruptCompletion = !1, _didIteratorError = !1;
try {
for(var _step, _iterator = _asyncIterator({
}); _iteratorAbruptCompletion = !(_step = yield _iterator.next()).done; _iteratorAbruptCompletion = !1);
}); _iteratorAbruptCompletion = !(_step = yield _awaitAsyncGenerator(_iterator.next())).done; _iteratorAbruptCompletion = !1);
} catch (err) {
_didIteratorError = !0, _iteratorError = err;
} finally{
@ -135,7 +138,7 @@ function _f2() {
var _iteratorError2, _iteratorAbruptCompletion2 = !1, _didIteratorError2 = !1;
try {
for(var _step2, _iterator2 = _asyncIterator({
}); _iteratorAbruptCompletion2 = !(_step2 = yield _iterator2.next()).done; _iteratorAbruptCompletion2 = !1);
}); _iteratorAbruptCompletion2 = !(_step2 = yield _awaitAsyncGenerator(_iterator2.next())).done; _iteratorAbruptCompletion2 = !1);
} catch (err2) {
_didIteratorError2 = !0, _iteratorError2 = err2;
} finally{

View File

@ -123,6 +123,9 @@ function _asyncToGenerator(fn) {
});
};
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -287,7 +290,7 @@ function _f2() {
});
case 4:
_ctx.next = 6;
return _iterator.next();
return _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;
@ -336,7 +339,7 @@ function _f2() {
});
case 30:
_ctx.next = 32;
return _iterator2.next();
return _awaitAsyncGenerator(_iterator2.next());
case 32:
if (!(_iteratorAbruptCompletion2 = !(_step2 = _ctx.sent).done)) {
_ctx.next = 37;

View File

@ -67,6 +67,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
}
info.done ? resolve(value) : Promise.resolve(value).then(_next, _throw);
}
function _awaitAsyncGenerator(value) {
return new _AwaitValue(value);
}
function _AwaitValue(value) {
this.wrapped = value;
}
@ -204,7 +207,7 @@ function _f2() {
_iteratorAbruptCompletion = !1, _didIteratorError = !1, _ctx.prev = 2, _iterator = _asyncIterator({
});
case 4:
return _ctx.next = 6, _iterator.next();
return _ctx.next = 6, _awaitAsyncGenerator(_iterator.next());
case 6:
if (!(_iteratorAbruptCompletion = !(_step = _ctx.sent).done)) {
_ctx.next = 11;
@ -239,7 +242,7 @@ function _f2() {
_iteratorAbruptCompletion2 = !1, _didIteratorError2 = !1, _ctx.prev = 28, _iterator2 = _asyncIterator({
});
case 30:
return _ctx.next = 32, _iterator2.next();
return _ctx.next = 32, _awaitAsyncGenerator(_iterator2.next());
case 32:
if (!(_iteratorAbruptCompletion2 = !(_step2 = _ctx.sent).done)) {
_ctx.next = 37;