mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Added es5 conformance tests for async arrow functions, add error for referencing 'arguments' in a generator.
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
|
||||
const x = async => async;
|
||||
@@ -0,0 +1,8 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
var f = (await) => {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
function f(await = await) {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
var await = () => {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
|
||||
var foo = async (await): Promise<void> => {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
|
||||
var bar = async (): Promise<void> => {
|
||||
// 'await' here is an identifier, and not an await expression.
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
var v = { [await]: foo }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
var foo = async (a = await => await): Promise<void> => {
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
class C {
|
||||
method() {
|
||||
function other() {}
|
||||
var fn = async () => await other.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
class C {
|
||||
method() {
|
||||
var fn = async () => await this;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
|
||||
declare function someOtherFunction(i: any): Promise<void>;
|
||||
const x = async i => await someOtherFunction(i)
|
||||
const x1 = async (i) => await someOtherFunction(i);
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// @target: ES5
|
||||
// @lib: es5,es2015.promise
|
||||
// @noEmitHelpers: true
|
||||
class C {
|
||||
method() {
|
||||
function other() {}
|
||||
async function fn () {
|
||||
await other.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user