ES6 tests for async generators

This commit is contained in:
Ron Buckton 2016-11-18 00:11:53 -08:00
parent 42085a6576
commit c758359a63
338 changed files with 4118 additions and 17 deletions

View File

@ -146,7 +146,11 @@ namespace ts {
enclosingFunctionFlags & FunctionFlags.Async ?
node.asteriskToken ?
createAsyncDelegatorHelper(context, expression, expression) :
createArrayLiteral([createLiteral("yield"), expression]) :
createArrayLiteral(
expression ?
[createLiteral("yield"), expression] :
[createLiteral("yield")]
) :
expression
);
}

View File

@ -0,0 +1,22 @@
//// [asyncGenerators.classMethod.1.es6.ts]
class C {
async * f() {}
}
//// [asyncGenerators.classMethod.1.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() { return __asyncGenerator(this, arguments, function* f_1() { }); }
}

View File

@ -0,0 +1,8 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.1.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.1.es6.ts, 0, 0))
async * f() {}
>f : Symbol(C.f, Decl(asyncGenerators.classMethod.1.es6.ts, 0, 9))
}

View File

@ -0,0 +1,8 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.1.es6.ts ===
class C {
>C : C
async * f() {}
>f : () => AsyncIterableIterator<any>
}

View File

@ -0,0 +1,18 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.10.es6.ts(3,26): error TS1003: Identifier expected.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.10.es6.ts(3,32): error TS1109: Expression expected.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.10.es6.ts(3,34): error TS1005: ';' expected.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.10.es6.ts (3 errors) ====
class C {
async * f() {
async function * await() {
~~~~~
!!! error TS1003: Identifier expected.
~
!!! error TS1109: Expression expected.
~
!!! error TS1005: ';' expected.
}
}
}

View File

@ -0,0 +1,31 @@
//// [asyncGenerators.classMethod.10.es6.ts]
class C {
async * f() {
async function * await() {
}
}
}
//// [asyncGenerators.classMethod.10.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
function () { return __asyncGenerator(this, arguments, function* _1() { }); }
yield ["await", ()];
{
}
});
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.classMethod.11.es6.ts]
class C {
async * f() {
yield;
}
}
//// [asyncGenerators.classMethod.11.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield ["yield"];
});
}
}

View File

@ -0,0 +1,10 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.11.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.11.es6.ts, 0, 0))
async * f() {
>f : Symbol(C.f, Decl(asyncGenerators.classMethod.11.es6.ts, 0, 9))
yield;
}
}

View File

@ -0,0 +1,11 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.11.es6.ts ===
class C {
>C : C
async * f() {
>f : () => AsyncIterableIterator<any>
yield;
>yield : any
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.classMethod.12.es6.ts]
class C {
async * f() {
yield 1;
}
}
//// [asyncGenerators.classMethod.12.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield ["yield", 1];
});
}
}

View File

@ -0,0 +1,10 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.12.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.12.es6.ts, 0, 0))
async * f() {
>f : Symbol(C.f, Decl(asyncGenerators.classMethod.12.es6.ts, 0, 9))
yield 1;
}
}

View File

@ -0,0 +1,12 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.12.es6.ts ===
class C {
>C : C
async * f() {
>f : () => AsyncIterableIterator<1>
yield 1;
>yield 1 : any
>1 : 1
}
}

View File

@ -0,0 +1,32 @@
//// [asyncGenerators.classMethod.13.es6.ts]
class C {
async * f() {
yield * [];
}
}
//// [asyncGenerators.classMethod.13.es6.js]
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) };
return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; }
};
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield* __asyncDelegator([]);
});
}
}

View File

@ -0,0 +1,10 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.13.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.13.es6.ts, 0, 0))
async * f() {
>f : Symbol(C.f, Decl(asyncGenerators.classMethod.13.es6.ts, 0, 9))
yield * [];
}
}

View File

@ -0,0 +1,12 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.13.es6.ts ===
class C {
>C : C
async * f() {
>f : () => AsyncIterableIterator<undefined>
yield * [];
>yield * [] : any
>[] : undefined[]
}
}

View File

@ -0,0 +1,33 @@
//// [asyncGenerators.classMethod.14.es6.ts]
declare const ai: AsyncIterable<number>;
class C {
async * f() {
yield * ai;
}
}
//// [asyncGenerators.classMethod.14.es6.js]
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) };
return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; }
};
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield* __asyncDelegator(ai);
});
}
}

View File

@ -0,0 +1,15 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.14.es6.ts ===
declare const ai: AsyncIterable<number>;
>ai : Symbol(ai, Decl(asyncGenerators.classMethod.14.es6.ts, 0, 13))
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2017.asynciterable.d.ts, --, --))
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.14.es6.ts, 0, 40))
async * f() {
>f : Symbol(C.f, Decl(asyncGenerators.classMethod.14.es6.ts, 1, 9))
yield * ai;
>ai : Symbol(ai, Decl(asyncGenerators.classMethod.14.es6.ts, 0, 13))
}
}

View File

@ -0,0 +1,16 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.14.es6.ts ===
declare const ai: AsyncIterable<number>;
>ai : AsyncIterable<number>
>AsyncIterable : AsyncIterable<T>
class C {
>C : C
async * f() {
>f : () => AsyncIterableIterator<number>
yield * ai;
>yield * ai : any
>ai : AsyncIterable<number>
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.classMethod.15.es6.ts]
class C {
async * f() {
await 1;
}
}
//// [asyncGenerators.classMethod.15.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield ["await", 1];
});
}
}

View File

@ -0,0 +1,10 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.15.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.15.es6.ts, 0, 0))
async * f() {
>f : Symbol(C.f, Decl(asyncGenerators.classMethod.15.es6.ts, 0, 9))
await 1;
}
}

View File

@ -0,0 +1,12 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.15.es6.ts ===
class C {
>C : C
async * f() {
>f : () => AsyncIterableIterator<any>
await 1;
>await 1 : 1
>1 : 1
}
}

View File

@ -0,0 +1,11 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.16.es6.ts(3,14): error TS1109: Expression expected.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.16.es6.ts (1 errors) ====
class C {
async * f() {
await;
~
!!! error TS1109: Expression expected.
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.classMethod.16.es6.ts]
class C {
async * f() {
await;
}
}
//// [asyncGenerators.classMethod.16.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield ["await", ];
});
}
}

View File

@ -0,0 +1,11 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.17.es6.ts(3,16): error TS2304: Cannot find name 'await'.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.17.es6.ts (1 errors) ====
class C {
async * f() {
var x: await;
~~~~~
!!! error TS2304: Cannot find name 'await'.
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.classMethod.17.es6.ts]
class C {
async * f() {
var x: await;
}
}
//// [asyncGenerators.classMethod.17.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
var x;
});
}
}

View File

@ -0,0 +1,14 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.18.es6.ts(3,16): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.18.es6.ts(3,16): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.18.es6.ts (2 errors) ====
class C {
async * f() {
var x: yield;
~~~~~
!!! error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.classMethod.18.es6.ts]
class C {
async * f() {
var x: yield;
}
}
//// [asyncGenerators.classMethod.18.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
var x;
});
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.classMethod.19.es6.ts]
class C {
async * f() {
var x = { [yield]: 1 };
}
}
//// [asyncGenerators.classMethod.19.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
var x = { [yield ["yield"]]: 1 };
});
}
}

View File

@ -0,0 +1,11 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.19.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.19.es6.ts, 0, 0))
async * f() {
>f : Symbol(C.f, Decl(asyncGenerators.classMethod.19.es6.ts, 0, 9))
var x = { [yield]: 1 };
>x : Symbol(x, Decl(asyncGenerators.classMethod.19.es6.ts, 2, 11))
}
}

View File

@ -0,0 +1,14 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.19.es6.ts ===
class C {
>C : C
async * f() {
>f : () => AsyncIterableIterator<any>
var x = { [yield]: 1 };
>x : { [x: number]: number; }
>{ [yield]: 1 } : { [x: number]: number; }
>yield : any
>1 : 1
}
}

View File

@ -0,0 +1,21 @@
//// [asyncGenerators.classMethod.2.es6.ts]
class C {
async * await() {}
}
//// [asyncGenerators.classMethod.2.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
await() { return __asyncGenerator(this, arguments, function* await_1() { }); }
}

View File

@ -0,0 +1,7 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.2.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.2.es6.ts, 0, 0))
async * await() {}
>await : Symbol(C.await, Decl(asyncGenerators.classMethod.2.es6.ts, 0, 9))
}

View File

@ -0,0 +1,7 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.2.es6.ts ===
class C {
>C : C
async * await() {}
>await : () => AsyncIterableIterator<any>
}

View File

@ -0,0 +1,14 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.20.es6.ts(3,16): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.20.es6.ts(3,16): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.20.es6.ts (2 errors) ====
class C {
async * f() {
var x: yield;
~~~~~
!!! error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.classMethod.20.es6.ts]
class C {
async * f() {
var x: yield;
}
}
//// [asyncGenerators.classMethod.20.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
var x;
});
}
}

View File

@ -0,0 +1,13 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.21.es6.ts(2,14): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.21.es6.ts(2,14): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.21.es6.ts (2 errors) ====
class C {
async * [yield]() {
~~~~~
!!! error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}
}

View File

@ -0,0 +1,25 @@
//// [asyncGenerators.classMethod.21.es6.ts]
class C {
async * [yield]() {
}
}
//// [asyncGenerators.classMethod.21.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
[yield]() {
return __asyncGenerator(this, arguments, function* _a() {
});
}
}

View File

@ -0,0 +1,10 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.22.es6.ts(2,14): error TS2304: Cannot find name 'await'.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.22.es6.ts (1 errors) ====
class C {
async * [await]() {
~~~~~
!!! error TS2304: Cannot find name 'await'.
}
}

View File

@ -0,0 +1,25 @@
//// [asyncGenerators.classMethod.22.es6.ts]
class C {
async * [await]() {
}
}
//// [asyncGenerators.classMethod.22.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
[await]() {
return __asyncGenerator(this, arguments, function* _a() {
});
}
}

View File

@ -0,0 +1,21 @@
//// [asyncGenerators.classMethod.3.es6.ts]
class C {
async * yield() {}
}
//// [asyncGenerators.classMethod.3.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
yield() { return __asyncGenerator(this, arguments, function* yield_1() { }); }
}

View File

@ -0,0 +1,7 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.3.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.3.es6.ts, 0, 0))
async * yield() {}
>yield : Symbol(C.yield, Decl(asyncGenerators.classMethod.3.es6.ts, 0, 9))
}

View File

@ -0,0 +1,7 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.3.es6.ts ===
class C {
>C : C
async * yield() {}
>yield : () => AsyncIterableIterator<any>
}

View File

@ -0,0 +1,18 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.4.es6.ts(2,15): error TS1138: Parameter declaration expected.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.4.es6.ts(2,15): error TS2304: Cannot find name 'await'.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.4.es6.ts(2,20): error TS1005: ';' expected.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.4.es6.ts(3,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.4.es6.ts (4 errors) ====
class C {
async * f(await) {}
~~~~~
!!! error TS1138: Parameter declaration expected.
~~~~~
!!! error TS2304: Cannot find name 'await'.
~
!!! error TS1005: ';' expected.
}
~
!!! error TS1128: Declaration or statement expected.

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.classMethod.4.es6.ts]
class C {
async * f(await) {}
}
//// [asyncGenerators.classMethod.4.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() { return __asyncGenerator(this, arguments, function* f_1() { }); }
}
await;
{ }

View File

@ -0,0 +1,18 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.5.es6.ts(2,15): error TS1138: Parameter declaration expected.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.5.es6.ts(2,15): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.5.es6.ts(2,20): error TS1005: ';' expected.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.5.es6.ts(3,1): error TS1128: Declaration or statement expected.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.5.es6.ts (4 errors) ====
class C {
async * f(yield) {}
~~~~~
!!! error TS1138: Parameter declaration expected.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
~
!!! error TS1005: ';' expected.
}
~
!!! error TS1128: Declaration or statement expected.

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.classMethod.5.es6.ts]
class C {
async * f(yield) {}
}
//// [asyncGenerators.classMethod.5.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() { return __asyncGenerator(this, arguments, function* f_1() { }); }
}
yield;
{ }

View File

@ -0,0 +1,9 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.6.es6.ts(2,19): error TS2524: 'await' expressions cannot be used in a parameter initializer.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.6.es6.ts (1 errors) ====
class C {
async * f(a = await 1) {}
~~~~~~~
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
}

View File

@ -0,0 +1,21 @@
//// [asyncGenerators.classMethod.6.es6.ts]
class C {
async * f(a = await 1) {}
}
//// [asyncGenerators.classMethod.6.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f(a = yield ["await", 1]) { return __asyncGenerator(this, arguments, function* f_1() { }); }
}

View File

@ -0,0 +1,12 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.7.es6.ts(2,19): error TS1163: A 'yield' expression is only allowed in a generator body.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.7.es6.ts(2,19): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.7.es6.ts (2 errors) ====
class C {
async * f(a = yield) {}
~~~~~
!!! error TS1163: A 'yield' expression is only allowed in a generator body.
~~~~~
!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer.
}

View File

@ -0,0 +1,21 @@
//// [asyncGenerators.classMethod.7.es6.ts]
class C {
async * f(a = yield) {}
}
//// [asyncGenerators.classMethod.7.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f(a = yield ["yield"]) { return __asyncGenerator(this, arguments, function* f_1() { }); }
}

View File

@ -0,0 +1,31 @@
//// [asyncGenerators.classMethod.8.es6.ts]
class C {
async * f() {
async function * g() {
}
}
}
//// [asyncGenerators.classMethod.8.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
function g() {
return __asyncGenerator(this, arguments, function* g_1() {
});
}
});
}
}

View File

@ -0,0 +1,12 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.8.es6.ts ===
class C {
>C : Symbol(C, Decl(asyncGenerators.classMethod.8.es6.ts, 0, 0))
async * f() {
>f : Symbol(C.f, Decl(asyncGenerators.classMethod.8.es6.ts, 0, 9))
async function * g() {
>g : Symbol(g, Decl(asyncGenerators.classMethod.8.es6.ts, 1, 17))
}
}
}

View File

@ -0,0 +1,12 @@
=== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.8.es6.ts ===
class C {
>C : C
async * f() {
>f : () => AsyncIterableIterator<any>
async function * g() {
>g : () => AsyncIterableIterator<any>
}
}
}

View File

@ -0,0 +1,15 @@
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.9.es6.ts(3,26): error TS1003: Identifier expected.
tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.9.es6.ts(3,34): error TS1005: '=>' expected.
==== tests/cases/conformance/asyncGenerators/es6/classMethods/asyncGenerators.classMethod.9.es6.ts (2 errors) ====
class C {
async * f() {
async function * yield() {
~~~~~
!!! error TS1003: Identifier expected.
~
!!! error TS1005: '=>' expected.
}
}
}

View File

@ -0,0 +1,30 @@
//// [asyncGenerators.classMethod.9.es6.ts]
class C {
async * f() {
async function * yield() {
}
}
}
//// [asyncGenerators.classMethod.9.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
class C {
f() {
return __asyncGenerator(this, arguments, function* f_1() {
function () { return __asyncGenerator(this, arguments, function* _1() { }); }
yield ["yield", () => {
}];
});
}
}

View File

@ -0,0 +1,17 @@
//// [asyncGenerators.functionDeclaration.1.es6.ts]
async function * f() {}
//// [asyncGenerators.functionDeclaration.1.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() { return __asyncGenerator(this, arguments, function* f_1() { }); }

View File

@ -0,0 +1,4 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.1.es6.ts ===
async function * f() {}
>f : Symbol(f, Decl(asyncGenerators.functionDeclaration.1.es6.ts, 0, 0))

View File

@ -0,0 +1,4 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.1.es6.ts ===
async function * f() {}
>f : () => AsyncIterableIterator<any>

View File

@ -0,0 +1,16 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.10.es6.ts(2,22): error TS1003: Identifier expected.
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.10.es6.ts(2,28): error TS1109: Expression expected.
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.10.es6.ts(2,30): error TS1005: ';' expected.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.10.es6.ts (3 errors) ====
async function * f() {
async function * await() {
~~~~~
!!! error TS1003: Identifier expected.
~
!!! error TS1109: Expression expected.
~
!!! error TS1005: ';' expected.
}
}

View File

@ -0,0 +1,27 @@
//// [asyncGenerators.functionDeclaration.10.es6.ts]
async function * f() {
async function * await() {
}
}
//// [asyncGenerators.functionDeclaration.10.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
function () { return __asyncGenerator(this, arguments, function* _1() { }); }
yield ["await", ()];
{
}
});
}

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.functionDeclaration.11.es6.ts]
async function * f() {
yield;
}
//// [asyncGenerators.functionDeclaration.11.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield ["yield"];
});
}

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.11.es6.ts ===
async function * f() {
>f : Symbol(f, Decl(asyncGenerators.functionDeclaration.11.es6.ts, 0, 0))
yield;
}

View File

@ -0,0 +1,7 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.11.es6.ts ===
async function * f() {
>f : () => AsyncIterableIterator<any>
yield;
>yield : any
}

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.functionDeclaration.12.es6.ts]
async function * f() {
yield 1;
}
//// [asyncGenerators.functionDeclaration.12.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield ["yield", 1];
});
}

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.12.es6.ts ===
async function * f() {
>f : Symbol(f, Decl(asyncGenerators.functionDeclaration.12.es6.ts, 0, 0))
yield 1;
}

View File

@ -0,0 +1,8 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.12.es6.ts ===
async function * f() {
>f : () => AsyncIterableIterator<1>
yield 1;
>yield 1 : any
>1 : 1
}

View File

@ -0,0 +1,28 @@
//// [asyncGenerators.functionDeclaration.13.es6.ts]
async function * f() {
yield * [];
}
//// [asyncGenerators.functionDeclaration.13.es6.js]
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) };
return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; }
};
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield* __asyncDelegator([]);
});
}

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.13.es6.ts ===
async function * f() {
>f : Symbol(f, Decl(asyncGenerators.functionDeclaration.13.es6.ts, 0, 0))
yield * [];
}

View File

@ -0,0 +1,8 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.13.es6.ts ===
async function * f() {
>f : () => AsyncIterableIterator<undefined>
yield * [];
>yield * [] : any
>[] : undefined[]
}

View File

@ -0,0 +1,28 @@
//// [asyncGenerators.functionDeclaration.14.es6.ts]
async function * f() {
yield * f();
}
//// [asyncGenerators.functionDeclaration.14.es6.js]
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) };
return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; }
};
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield* __asyncDelegator(f());
});
}

View File

@ -0,0 +1,7 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.14.es6.ts ===
async function * f() {
>f : Symbol(f, Decl(asyncGenerators.functionDeclaration.14.es6.ts, 0, 0))
yield * f();
>f : Symbol(f, Decl(asyncGenerators.functionDeclaration.14.es6.ts, 0, 0))
}

View File

@ -0,0 +1,9 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.14.es6.ts ===
async function * f() {
>f : () => any
yield * f();
>yield * f() : any
>f() : any
>f : () => any
}

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.functionDeclaration.15.es6.ts]
async function * f() {
await 1;
}
//// [asyncGenerators.functionDeclaration.15.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield ["await", 1];
});
}

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.15.es6.ts ===
async function * f() {
>f : Symbol(f, Decl(asyncGenerators.functionDeclaration.15.es6.ts, 0, 0))
await 1;
}

View File

@ -0,0 +1,8 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.15.es6.ts ===
async function * f() {
>f : () => AsyncIterableIterator<any>
await 1;
>await 1 : 1
>1 : 1
}

View File

@ -0,0 +1,9 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.16.es6.ts(2,10): error TS1109: Expression expected.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.16.es6.ts (1 errors) ====
async function * f() {
await;
~
!!! error TS1109: Expression expected.
}

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.functionDeclaration.16.es6.ts]
async function * f() {
await;
}
//// [asyncGenerators.functionDeclaration.16.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
yield ["await", ];
});
}

View File

@ -0,0 +1,9 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.17.es6.ts(2,12): error TS2304: Cannot find name 'await'.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.17.es6.ts (1 errors) ====
async function * f() {
var x: await;
~~~~~
!!! error TS2304: Cannot find name 'await'.
}

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.functionDeclaration.17.es6.ts]
async function * f() {
var x: await;
}
//// [asyncGenerators.functionDeclaration.17.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
var x;
});
}

View File

@ -0,0 +1,9 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.18.es6.ts(2,12): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.18.es6.ts (1 errors) ====
async function * f() {
var x: yield;
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.functionDeclaration.18.es6.ts]
async function * f() {
var x: yield;
}
//// [asyncGenerators.functionDeclaration.18.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
var x;
});
}

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.functionDeclaration.19.es6.ts]
async function * f() {
var x = { [yield]: 1 };
}
//// [asyncGenerators.functionDeclaration.19.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
var x = { [yield ["yield"]]: 1 };
});
}

View File

@ -0,0 +1,7 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.19.es6.ts ===
async function * f() {
>f : Symbol(f, Decl(asyncGenerators.functionDeclaration.19.es6.ts, 0, 0))
var x = { [yield]: 1 };
>x : Symbol(x, Decl(asyncGenerators.functionDeclaration.19.es6.ts, 1, 7))
}

View File

@ -0,0 +1,10 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.19.es6.ts ===
async function * f() {
>f : () => AsyncIterableIterator<any>
var x = { [yield]: 1 };
>x : { [x: number]: number; }
>{ [yield]: 1 } : { [x: number]: number; }
>yield : any
>1 : 1
}

View File

@ -0,0 +1,17 @@
//// [asyncGenerators.functionDeclaration.2.es6.ts]
async function * await() {}
//// [asyncGenerators.functionDeclaration.2.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function await() { return __asyncGenerator(this, arguments, function* await_1() { }); }

View File

@ -0,0 +1,4 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.2.es6.ts ===
async function * await() {}
>await : Symbol(await, Decl(asyncGenerators.functionDeclaration.2.es6.ts, 0, 0))

View File

@ -0,0 +1,4 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.2.es6.ts ===
async function * await() {}
>await : () => AsyncIterableIterator<any>

View File

@ -0,0 +1,9 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.20.es6.ts(2,12): error TS2304: Cannot find name 'yield'.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.20.es6.ts (1 errors) ====
async function * f() {
var x: yield;
~~~~~
!!! error TS2304: Cannot find name 'yield'.
}

View File

@ -0,0 +1,23 @@
//// [asyncGenerators.functionDeclaration.20.es6.ts]
async function * f() {
var x: yield;
}
//// [asyncGenerators.functionDeclaration.20.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() {
return __asyncGenerator(this, arguments, function* f_1() {
var x;
});
}

View File

@ -0,0 +1,17 @@
//// [asyncGenerators.functionDeclaration.3.es6.ts]
async function * yield() {}
//// [asyncGenerators.functionDeclaration.3.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function yield() { return __asyncGenerator(this, arguments, function* yield_1() { }); }

View File

@ -0,0 +1,4 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.3.es6.ts ===
async function * yield() {}
>yield : Symbol(yield, Decl(asyncGenerators.functionDeclaration.3.es6.ts, 0, 0))

View File

@ -0,0 +1,4 @@
=== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.3.es6.ts ===
async function * yield() {}
>yield : () => AsyncIterableIterator<any>

View File

@ -0,0 +1,13 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.4.es6.ts(1,20): error TS1138: Parameter declaration expected.
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.4.es6.ts(1,20): error TS2304: Cannot find name 'await'.
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.4.es6.ts(1,25): error TS1005: ';' expected.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.4.es6.ts (3 errors) ====
async function * f(await) {}
~~~~~
!!! error TS1138: Parameter declaration expected.
~~~~~
!!! error TS2304: Cannot find name 'await'.
~
!!! error TS1005: ';' expected.

View File

@ -0,0 +1,19 @@
//// [asyncGenerators.functionDeclaration.4.es6.ts]
async function * f(await) {}
//// [asyncGenerators.functionDeclaration.4.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() { return __asyncGenerator(this, arguments, function* f_1() { }); }
await;
{ }

View File

@ -0,0 +1,13 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.5.es6.ts(1,20): error TS1138: Parameter declaration expected.
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.5.es6.ts(1,20): error TS2304: Cannot find name 'yield'.
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.5.es6.ts(1,25): error TS1005: ';' expected.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.5.es6.ts (3 errors) ====
async function * f(yield) {}
~~~~~
!!! error TS1138: Parameter declaration expected.
~~~~~
!!! error TS2304: Cannot find name 'yield'.
~
!!! error TS1005: ';' expected.

View File

@ -0,0 +1,19 @@
//// [asyncGenerators.functionDeclaration.5.es6.ts]
async function * f(yield) {}
//// [asyncGenerators.functionDeclaration.5.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f() { return __asyncGenerator(this, arguments, function* f_1() { }); }
yield;
{ }

View File

@ -0,0 +1,7 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.6.es6.ts(1,24): error TS2524: 'await' expressions cannot be used in a parameter initializer.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.6.es6.ts (1 errors) ====
async function * f(a = await 1) {}
~~~~~~~
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.

View File

@ -0,0 +1,17 @@
//// [asyncGenerators.functionDeclaration.6.es6.ts]
async function * f(a = await 1) {}
//// [asyncGenerators.functionDeclaration.6.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f(a = yield ["await", 1]) { return __asyncGenerator(this, arguments, function* f_1() { }); }

View File

@ -0,0 +1,7 @@
tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.7.es6.ts(1,24): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
==== tests/cases/conformance/asyncGenerators/es6/functionDeclarations/asyncGenerators.functionDeclaration.7.es6.ts (1 errors) ====
async function * f(a = yield) {}
~~~~~
!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer.

View File

@ -0,0 +1,17 @@
//// [asyncGenerators.functionDeclaration.7.es6.ts]
async function * f(a = yield) {}
//// [asyncGenerators.functionDeclaration.7.es6.js]
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { c = void 0, f(v), next(); }
};
function f(a = yield ["yield"]) { return __asyncGenerator(this, arguments, function* f_1() { }); }

Some files were not shown because too many files have changed in this diff Show More