Files
tsgo/testdata/baselines/reference/submodule/compiler/asyncAwaitWithCapturedBlockScopeVar(target=es2015).js

81 lines
1.6 KiB
TypeScript

//// [tests/cases/compiler/asyncAwaitWithCapturedBlockScopeVar.ts] ////
//// [asyncAwaitWithCapturedBlockScopeVar.ts]
async function fn1() {
let ar = [];
for (let i = 0; i < 1; i++) {
await 1;
ar.push(() => i);
}
}
async function fn2() {
let ar = [];
for (let i = 0; i < 1; i++) {
await 1;
ar.push(() => i);
break;
}
}
async function fn3() {
let ar = [];
for (let i = 0; i < 1; i++) {
await 1;
ar.push(() => i);
continue;
}
}
async function fn4(): Promise<number> {
let ar = [];
for (let i = 0; i < 1; i++) {
await 1;
ar.push(() => i);
return 1;
}
}
//// [asyncAwaitWithCapturedBlockScopeVar.js]
"use strict";
function fn1() {
return __awaiter(this, void 0, void 0, function* () {
let ar = [];
for (let i = 0; i < 1; i++) {
yield 1;
ar.push(() => i);
}
});
}
function fn2() {
return __awaiter(this, void 0, void 0, function* () {
let ar = [];
for (let i = 0; i < 1; i++) {
yield 1;
ar.push(() => i);
break;
}
});
}
function fn3() {
return __awaiter(this, void 0, void 0, function* () {
let ar = [];
for (let i = 0; i < 1; i++) {
yield 1;
ar.push(() => i);
continue;
}
});
}
function fn4() {
return __awaiter(this, void 0, void 0, function* () {
let ar = [];
for (let i = 0; i < 1; i++) {
yield 1;
ar.push(() => i);
return 1;
}
});
}