From 203dab44122fea4bb2efb558a41ec098e4368bed Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 27 Jun 2016 17:12:24 -0700 Subject: [PATCH] Added additional es5 conformance tests, better emit for functions returning global promise, pass this to __generator --- src/compiler/checker.ts | 23 +- src/compiler/emitter.ts | 4 +- src/compiler/transformers/generators.ts | 33 +-- src/compiler/transformers/ts.ts | 20 +- src/compiler/types.ts | 3 +- .../reference/asyncAliasReturnType_es5.js | 14 ++ .../asyncAliasReturnType_es5.symbols | 11 + .../reference/asyncAliasReturnType_es5.types | 11 + .../asyncAwaitIsolatedModules_es5.errors.txt | 45 ++++ .../asyncAwaitIsolatedModules_es5.js | 201 ++++++++++++++++++ tests/baselines/reference/asyncAwait_es5.js | 200 +++++++++++++++++ .../reference/asyncAwait_es5.symbols | 118 ++++++++++ .../baselines/reference/asyncAwait_es5.types | 129 +++++++++++ .../reference/asyncClass_es5.errors.txt | 8 + tests/baselines/reference/asyncClass_es5.js | 10 + .../reference/asyncConstructor_es5.errors.txt | 10 + .../reference/asyncConstructor_es5.js | 12 ++ .../reference/asyncDeclare_es5.errors.txt | 7 + tests/baselines/reference/asyncDeclare_es5.js | 4 + .../reference/asyncEnum_es5.errors.txt | 9 + tests/baselines/reference/asyncEnum_es5.js | 10 + .../asyncFunctionDeclaration11_es5.js | 4 +- .../asyncFunctionDeclaration13_es5.js | 4 +- .../asyncFunctionDeclaration14_es5.js | 4 +- .../asyncFunctionDeclaration15_es5.errors.txt | 24 +-- .../asyncFunctionDeclaration15_es5.js | 38 ++-- .../asyncFunctionDeclaration1_es5.js | 4 +- .../asyncFunctionDeclaration6_es5.js | 4 +- .../asyncFunctionDeclaration7_es5.js | 8 +- .../asyncFunctionDeclaration9_es5.js | 4 +- .../reference/asyncGetter_es5.errors.txt | 13 ++ tests/baselines/reference/asyncGetter_es5.js | 18 ++ .../reference/asyncImportedPromise_es5.js | 84 ++++++++ .../asyncImportedPromise_es5.symbols | 20 ++ .../reference/asyncImportedPromise_es5.types | 20 ++ .../reference/asyncInterface_es5.errors.txt | 8 + .../baselines/reference/asyncInterface_es5.js | 5 + .../reference/asyncMethodWithSuper_es5.js | 106 +++++++++ .../asyncMethodWithSuper_es5.symbols | 102 +++++++++ .../reference/asyncMethodWithSuper_es5.types | 123 +++++++++++ .../reference/asyncModule_es5.errors.txt | 8 + tests/baselines/reference/asyncModule_es5.js | 5 + .../baselines/reference/asyncMultiFile_es5.js | 60 ++++++ .../reference/asyncMultiFile_es5.symbols | 8 + .../reference/asyncMultiFile_es5.types | 8 + .../reference/asyncQualifiedReturnType_es5.js | 28 +++ .../asyncQualifiedReturnType_es5.symbols | 17 ++ .../asyncQualifiedReturnType_es5.types | 17 ++ .../reference/asyncSetter_es5.errors.txt | 10 + tests/baselines/reference/asyncSetter_es5.js | 18 ++ .../baselines/reference/asyncUseStrict_es5.js | 23 ++ .../reference/asyncUseStrict_es5.symbols | 18 ++ .../reference/asyncUseStrict_es5.types | 22 ++ .../reference/awaitBinaryExpression1_es5.js | 4 +- .../reference/awaitBinaryExpression2_es5.js | 4 +- .../reference/awaitBinaryExpression3_es5.js | 4 +- .../reference/awaitBinaryExpression4_es5.js | 4 +- .../reference/awaitBinaryExpression5_es5.js | 4 +- .../reference/awaitCallExpression1_es5.js | 4 +- .../reference/awaitCallExpression2_es5.js | 4 +- .../reference/awaitCallExpression3_es5.js | 4 +- .../reference/awaitCallExpression4_es5.js | 4 +- .../reference/awaitCallExpression5_es5.js | 4 +- .../reference/awaitCallExpression6_es5.js | 4 +- .../reference/awaitCallExpression7_es5.js | 4 +- .../reference/awaitCallExpression8_es5.js | 4 +- .../reference/awaitClassExpression_es5.js | 31 +++ .../awaitClassExpression_es5.symbols | 18 ++ .../reference/awaitClassExpression_es5.types | 20 ++ tests/baselines/reference/awaitUnion_es5.js | 40 ++++ .../reference/awaitUnion_es5.symbols | 44 ++++ .../baselines/reference/awaitUnion_es5.types | 49 +++++ .../baselines/reference/es5-asyncFunction.js | 8 +- .../es5-asyncFunctionArrayLiterals.js | 16 +- .../es5-asyncFunctionBinaryExpressions.js | 62 +++--- .../es5-asyncFunctionCallExpressions.js | 42 ++-- .../es5-asyncFunctionConditionals.js | 6 +- .../es5-asyncFunctionDoStatements.js | 38 ++-- .../es5-asyncFunctionElementAccess.js | 6 +- .../es5-asyncFunctionForInStatements.js | 18 +- .../es5-asyncFunctionForOfStatements.js | 38 ++-- .../es5-asyncFunctionForStatements.js | 14 +- .../reference/es5-asyncFunctionHoisting.js | 4 +- .../es5-asyncFunctionIfStatements.js | 6 +- .../reference/es5-asyncFunctionNestedLoops.js | 2 +- .../es5-asyncFunctionNewExpressions.js | 42 ++-- .../es5-asyncFunctionObjectLiterals.js | 14 +- .../es5-asyncFunctionPropertyAccess.js | 6 +- .../es5-asyncFunctionReturnStatements.js | 24 +-- .../es5-asyncFunctionSwitchStatements.js | 18 +- .../es5-asyncFunctionTryStatements.js | 24 +-- .../es5-asyncFunctionWhileStatements.js | 38 ++-- .../es5-asyncFunctionWithStatements.js | 8 +- .../es5-importHelpersAsyncFunctions.js | 8 +- .../async/es5/asyncAliasReturnType_es5.ts | 7 + .../es5/asyncAwaitIsolatedModules_es5.ts | 42 ++++ .../conformance/async/es5/asyncAwait_es5.ts | 41 ++++ .../conformance/async/es5/asyncClass_es5.ts | 5 + .../async/es5/asyncConstructor_es5.ts | 7 + .../conformance/async/es5/asyncDeclare_es5.ts | 4 + .../conformance/async/es5/asyncEnum_es5.ts | 6 + .../conformance/async/es5/asyncGetter_es5.ts | 7 + .../async/es5/asyncImportedPromise_es5.ts | 11 + .../async/es5/asyncInterface_es5.ts | 5 + .../async/es5/asyncMethodWithSuper_es5.ts | 53 +++++ .../conformance/async/es5/asyncModule_es5.ts | 5 + .../async/es5/asyncMultiFile_es5.ts | 6 + .../async/es5/asyncQualifiedReturnType_es5.ts | 10 + .../conformance/async/es5/asyncSetter_es5.ts | 7 + .../async/es5/asyncUseStrict_es5.ts | 9 + .../async/es5/awaitClassExpression_es5.ts | 10 + .../conformance/async/es5/awaitUnion_es5.ts | 15 ++ 112 files changed, 2341 insertions(+), 322 deletions(-) create mode 100644 tests/baselines/reference/asyncAliasReturnType_es5.js create mode 100644 tests/baselines/reference/asyncAliasReturnType_es5.symbols create mode 100644 tests/baselines/reference/asyncAliasReturnType_es5.types create mode 100644 tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt create mode 100644 tests/baselines/reference/asyncAwaitIsolatedModules_es5.js create mode 100644 tests/baselines/reference/asyncAwait_es5.js create mode 100644 tests/baselines/reference/asyncAwait_es5.symbols create mode 100644 tests/baselines/reference/asyncAwait_es5.types create mode 100644 tests/baselines/reference/asyncClass_es5.errors.txt create mode 100644 tests/baselines/reference/asyncClass_es5.js create mode 100644 tests/baselines/reference/asyncConstructor_es5.errors.txt create mode 100644 tests/baselines/reference/asyncConstructor_es5.js create mode 100644 tests/baselines/reference/asyncDeclare_es5.errors.txt create mode 100644 tests/baselines/reference/asyncDeclare_es5.js create mode 100644 tests/baselines/reference/asyncEnum_es5.errors.txt create mode 100644 tests/baselines/reference/asyncEnum_es5.js create mode 100644 tests/baselines/reference/asyncGetter_es5.errors.txt create mode 100644 tests/baselines/reference/asyncGetter_es5.js create mode 100644 tests/baselines/reference/asyncImportedPromise_es5.js create mode 100644 tests/baselines/reference/asyncImportedPromise_es5.symbols create mode 100644 tests/baselines/reference/asyncImportedPromise_es5.types create mode 100644 tests/baselines/reference/asyncInterface_es5.errors.txt create mode 100644 tests/baselines/reference/asyncInterface_es5.js create mode 100644 tests/baselines/reference/asyncMethodWithSuper_es5.js create mode 100644 tests/baselines/reference/asyncMethodWithSuper_es5.symbols create mode 100644 tests/baselines/reference/asyncMethodWithSuper_es5.types create mode 100644 tests/baselines/reference/asyncModule_es5.errors.txt create mode 100644 tests/baselines/reference/asyncModule_es5.js create mode 100644 tests/baselines/reference/asyncMultiFile_es5.js create mode 100644 tests/baselines/reference/asyncMultiFile_es5.symbols create mode 100644 tests/baselines/reference/asyncMultiFile_es5.types create mode 100644 tests/baselines/reference/asyncQualifiedReturnType_es5.js create mode 100644 tests/baselines/reference/asyncQualifiedReturnType_es5.symbols create mode 100644 tests/baselines/reference/asyncQualifiedReturnType_es5.types create mode 100644 tests/baselines/reference/asyncSetter_es5.errors.txt create mode 100644 tests/baselines/reference/asyncSetter_es5.js create mode 100644 tests/baselines/reference/asyncUseStrict_es5.js create mode 100644 tests/baselines/reference/asyncUseStrict_es5.symbols create mode 100644 tests/baselines/reference/asyncUseStrict_es5.types create mode 100644 tests/baselines/reference/awaitClassExpression_es5.js create mode 100644 tests/baselines/reference/awaitClassExpression_es5.symbols create mode 100644 tests/baselines/reference/awaitClassExpression_es5.types create mode 100644 tests/baselines/reference/awaitUnion_es5.js create mode 100644 tests/baselines/reference/awaitUnion_es5.symbols create mode 100644 tests/baselines/reference/awaitUnion_es5.types create mode 100644 tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncAwait_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncClass_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncConstructor_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncDeclare_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncEnum_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncGetter_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncInterface_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncModule_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncMultiFile_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncSetter_es5.ts create mode 100644 tests/cases/conformance/async/es5/asyncUseStrict_es5.ts create mode 100644 tests/cases/conformance/async/es5/awaitClassExpression_es5.ts create mode 100644 tests/cases/conformance/async/es5/awaitUnion_es5.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 19ddbcdac04..56ec54781e7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -148,6 +148,7 @@ namespace ts { let getGlobalESSymbolConstructorSymbol: () => Symbol; let getGlobalPromiseConstructorSymbol: () => Symbol; + let tryGetGlobalPromiseConstructorSymbol: () => Symbol; let globalObjectType: ObjectType; let globalFunctionType: ObjectType; @@ -13922,7 +13923,7 @@ namespace ts { * @param returnType The return type of a FunctionLikeDeclaration * @param location The node on which to report the error. */ - function checkCorrectPromiseType(returnType: Type, location: Node) { + function checkCorrectPromiseType(returnType: Type, location: Node, diagnostic: DiagnosticMessage, typeName?: string) { if (returnType === unknownType) { // The return type already had some other error, so we ignore and return // the unknown type. @@ -13941,7 +13942,7 @@ namespace ts { // The promise type was not a valid type reference to the global promise type, so we // report an error and return the unknown type. - error(location, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); + error(location, diagnostic, typeName); return unknownType; } @@ -13961,7 +13962,7 @@ namespace ts { function checkAsyncFunctionReturnType(node: FunctionLikeDeclaration): Type { if (languageVersion >= ScriptTarget.ES6) { const returnType = getTypeFromTypeNode(node.type); - return checkCorrectPromiseType(returnType, node.type); + return checkCorrectPromiseType(returnType, node.type, Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type); } const globalPromiseConstructorLikeType = getGlobalPromiseConstructorLikeType(); @@ -14007,11 +14008,11 @@ namespace ts { const promiseConstructor = getNodeLinks(node.type).resolvedSymbol; if (!promiseConstructor || !symbolIsValue(promiseConstructor)) { + // try to fall back to global promise type. const typeName = promiseConstructor ? symbolToString(promiseConstructor) : typeToString(promiseType); - error(node, Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); - return unknownType; + return checkCorrectPromiseType(promiseType, node.type, Diagnostics.Type_0_is_not_a_valid_async_function_return_type, typeName); } // If the Promise constructor, resolved locally, is an alias symbol we should mark it as referenced. @@ -14019,7 +14020,7 @@ namespace ts { // Validate the promise constructor type. const promiseConstructorType = getTypeOfSymbol(promiseConstructor); - if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node, Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) { + if (!checkTypeAssignableTo(promiseConstructorType, globalPromiseConstructorLikeType, node.type, Diagnostics.Type_0_is_not_a_valid_async_function_return_type)) { return unknownType; } @@ -17520,6 +17521,11 @@ namespace ts { function getTypeReferenceSerializationKind(typeName: EntityName, location?: Node): TypeReferenceSerializationKind { // Resolve the symbol as a value to ensure the type can be reached at runtime during emit. const valueSymbol = resolveEntityName(typeName, SymbolFlags.Value, /*ignoreErrors*/ true, /*dontResolveAlias*/ false, location); + const globalPromiseSymbol = tryGetGlobalPromiseConstructorSymbol(); + if (globalPromiseSymbol && valueSymbol === globalPromiseSymbol) { + return TypeReferenceSerializationKind.Promise; + } + const constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; if (constructorType && isConstructorType(constructorType)) { return TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; @@ -17538,8 +17544,8 @@ namespace ts { else if (type.flags & TypeFlags.Any) { return TypeReferenceSerializationKind.ObjectType; } - else if (isTypeOfKind(type, TypeFlags.Void)) { - return TypeReferenceSerializationKind.VoidType; + else if (isTypeOfKind(type, TypeFlags.Void | TypeFlags.Nullable | TypeFlags.Never)) { + return TypeReferenceSerializationKind.VoidNullableOrNeverType; } else if (isTypeOfKind(type, TypeFlags.Boolean)) { return TypeReferenceSerializationKind.BooleanType; @@ -17837,6 +17843,7 @@ namespace ts { getGlobalPromiseLikeType = memoize(() => getGlobalType("PromiseLike", /*arity*/ 1)); getInstantiatedGlobalPromiseLikeType = memoize(createInstantiatedPromiseLikeType); getGlobalPromiseConstructorSymbol = memoize(() => getGlobalValueSymbol("Promise")); + tryGetGlobalPromiseConstructorSymbol = memoize(() => getGlobalSymbol("Promise", SymbolFlags.Value, /*diagnostic*/ undefined) && getGlobalPromiseConstructorSymbol()); getGlobalPromiseConstructorLikeType = memoize(() => getGlobalType("PromiseConstructorLike")); getGlobalThenableType = memoize(createThenableType); diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 09c785a24e3..ab01fd3dbfc 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -72,7 +72,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge };`; const generatorHelper = ` -var __generator = (this && this.__generator) || function (body) { +var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f; function step(op) { if (f) throw new TypeError("Generator is already executing."); @@ -97,7 +97,7 @@ var __generator = (this && this.__generator) || function (body) { _.trys.pop(); continue; } - op = body(_); + op = body.call(thisArg, _); } catch (e) { op = [6, e]; } finally { f = 0, sent = void 0; } diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index adb62f117ef..f96aacdce45 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -2554,21 +2554,24 @@ namespace ts { return createCall( createHelperName(currentSourceFile.externalHelpersModuleName, "__generator"), /*typeArguments*/ undefined, - [setNodeEmitFlags( - createFunctionExpression( - /*asteriskToken*/ undefined, - /*name*/ undefined, - /*typeParameters*/ undefined, - [createParameter(state)], - /*type*/ undefined, - createBlock( - buildResult, - /*location*/ undefined, - /*multiLine*/ buildResult.length > 0 - ) - ), - NodeEmitFlags.ReuseTempVariableScope - )] + [ + createThis(), + setNodeEmitFlags( + createFunctionExpression( + /*asteriskToken*/ undefined, + /*name*/ undefined, + /*typeParameters*/ undefined, + [createParameter(state)], + /*type*/ undefined, + createBlock( + buildResult, + /*location*/ undefined, + /*multiLine*/ buildResult.length > 0 + ) + ), + NodeEmitFlags.ReuseTempVariableScope + ) + ] ); } diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 57de884da33..2e2ed1be4b9 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1774,7 +1774,7 @@ namespace ts { case TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: return serializeEntityNameAsExpression(node.typeName, /*useFallback*/ false); - case TypeReferenceSerializationKind.VoidType: + case TypeReferenceSerializationKind.VoidNullableOrNeverType: return createVoidZero(); case TypeReferenceSerializationKind.BooleanType: @@ -1797,6 +1797,9 @@ namespace ts { case TypeReferenceSerializationKind.TypeWithCallSignature: return createIdentifier("Function"); + case TypeReferenceSerializationKind.Promise: + return createIdentifier("Promise"); + case TypeReferenceSerializationKind.ObjectType: default: return createIdentifier("Object"); @@ -2221,8 +2224,21 @@ namespace ts { } } + function getPromiseConstructor(type: TypeNode) { + const typeName = getEntityNameFromTypeNode(type); + if (typeName && isEntityName(typeName)) { + const serializationKind = resolver.getTypeReferenceSerializationKind(typeName); + if (serializationKind === TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue + || serializationKind === TypeReferenceSerializationKind.Unknown) { + return typeName; + } + } + + return undefined; + } + function transformAsyncFunctionBody(node: FunctionLikeDeclaration): ConciseBody | FunctionBody { - const promiseConstructor = languageVersion < ScriptTarget.ES6 ? getEntityNameFromTypeNode(node.type) : undefined; + const promiseConstructor = languageVersion < ScriptTarget.ES6 ? getPromiseConstructor(node.type) : undefined; const isArrowFunction = node.kind === SyntaxKind.ArrowFunction; const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & NodeCheckFlags.CaptureArguments) !== 0; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 71e4a202b40..a8be1a52634 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2043,12 +2043,13 @@ namespace ts { // function that can be reached at runtime (e.g. a `class` // declaration or a `var` declaration for the static side // of a type, such as the global `Promise` type in lib.d.ts). - VoidType, // The TypeReferenceNode resolves to a Void-like type. + VoidNullableOrNeverType, // The TypeReferenceNode resolves to a Void-like, Nullable, or Never type. NumberLikeType, // The TypeReferenceNode resolves to a Number-like type. StringLikeType, // The TypeReferenceNode resolves to a String-like type. BooleanType, // The TypeReferenceNode resolves to a Boolean-like type. ArrayLikeType, // The TypeReferenceNode resolves to an Array-like type. ESSymbolType, // The TypeReferenceNode resolves to the ESSymbol type. + Promise, // The TypeReferenceNode resolved to the global Promise constructor symbol. TypeWithCallSignature, // The TypeReferenceNode resolves to a Function type or a type // with call signatures. ObjectType, // The TypeReferenceNode resolves to any other type. diff --git a/tests/baselines/reference/asyncAliasReturnType_es5.js b/tests/baselines/reference/asyncAliasReturnType_es5.js new file mode 100644 index 00000000000..7684b413405 --- /dev/null +++ b/tests/baselines/reference/asyncAliasReturnType_es5.js @@ -0,0 +1,14 @@ +//// [asyncAliasReturnType_es5.ts] +type PromiseAlias = Promise; + +async function f(): PromiseAlias { +} + +//// [asyncAliasReturnType_es5.js] +function f() { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/]; + }); + }); +} diff --git a/tests/baselines/reference/asyncAliasReturnType_es5.symbols b/tests/baselines/reference/asyncAliasReturnType_es5.symbols new file mode 100644 index 00000000000..b61fbf6e275 --- /dev/null +++ b/tests/baselines/reference/asyncAliasReturnType_es5.symbols @@ -0,0 +1,11 @@ +=== tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts === +type PromiseAlias = Promise; +>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es5.ts, 0, 0)) +>T : Symbol(T, Decl(asyncAliasReturnType_es5.ts, 0, 18)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>T : Symbol(T, Decl(asyncAliasReturnType_es5.ts, 0, 18)) + +async function f(): PromiseAlias { +>f : Symbol(f, Decl(asyncAliasReturnType_es5.ts, 0, 34)) +>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es5.ts, 0, 0)) +} diff --git a/tests/baselines/reference/asyncAliasReturnType_es5.types b/tests/baselines/reference/asyncAliasReturnType_es5.types new file mode 100644 index 00000000000..2b8b576a4d3 --- /dev/null +++ b/tests/baselines/reference/asyncAliasReturnType_es5.types @@ -0,0 +1,11 @@ +=== tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts === +type PromiseAlias = Promise; +>PromiseAlias : Promise +>T : T +>Promise : Promise +>T : T + +async function f(): PromiseAlias { +>f : () => Promise +>PromiseAlias : Promise +} diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt new file mode 100644 index 00000000000..7d46517ca15 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts(1,27): error TS2307: Cannot find module 'missing'. + + +==== tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts (1 errors) ==== + import { MyPromise } from "missing"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'missing'. + + declare var p: Promise; + declare var mp: MyPromise; + + async function f0() { } + async function f1(): Promise { } + async function f3(): MyPromise { } + + let f4 = async function() { } + let f5 = async function(): Promise { } + let f6 = async function(): MyPromise { } + + let f7 = async () => { }; + let f8 = async (): Promise => { }; + let f9 = async (): MyPromise => { }; + let f10 = async () => p; + let f11 = async () => mp; + let f12 = async (): Promise => mp; + let f13 = async (): MyPromise => p; + + let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } + }; + + class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } + } + + module M { + export async function f1() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js new file mode 100644 index 00000000000..95416f3aaa2 --- /dev/null +++ b/tests/baselines/reference/asyncAwaitIsolatedModules_es5.js @@ -0,0 +1,201 @@ +//// [asyncAwaitIsolatedModules_es5.ts] +import { MyPromise } from "missing"; + +declare var p: Promise; +declare var mp: MyPromise; + +async function f0() { } +async function f1(): Promise { } +async function f3(): MyPromise { } + +let f4 = async function() { } +let f5 = async function(): Promise { } +let f6 = async function(): MyPromise { } + +let f7 = async () => { }; +let f8 = async (): Promise => { }; +let f9 = async (): MyPromise => { }; +let f10 = async () => p; +let f11 = async () => mp; +let f12 = async (): Promise => mp; +let f13 = async (): MyPromise => p; + +let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } +}; + +class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } +} + +module M { + export async function f1() { } +} + +//// [asyncAwaitIsolatedModules_es5.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f; + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (1) { + if (_.done) switch (op[0]) { + case 0: return { value: void 0, done: true }; + case 1: case 6: throw op[1]; + case 2: return { value: op[1], done: true }; + } + try { + switch (f = 1, op[0]) { + case 0: case 1: sent = op; break; + case 4: return _.label++, { value: op[1], done: false }; + case 7: op = _.stack.pop(), _.trys.pop(); continue; + default: + var r = _.trys.length > 0 && _.trys[_.trys.length - 1]; + if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; } + if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; } + if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; } + if (r[2]) { _.stack.pop(); } + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } + catch (e) { op = [6, e]; } + finally { f = 0, sent = void 0; } + } + } + return { + next: function (v) { return step([0, v]); }, + "throw": function (v) { return step([1, v]); }, + "return": function (v) { return step([2, v]); } + }; +}; +var _this = this; +function f0() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +} +function f1() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +} +function f3() { + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +} +var f4 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +}; +var f5 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +}; +var f6 = function () { + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +}; +var f7 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; +}); }); }; +var f8 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; +}); }); }; +var f9 = function () { return __awaiter(_this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; +}); }); }; +var f10 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, p]; +}); }); }; +var f11 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, mp]; +}); }); }; +var f12 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, mp]; +}); }); }; +var f13 = function () { return __awaiter(_this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/, p]; +}); }); }; +var o = { + m1: function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }, + m2: function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }, + m3: function () { + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + } +}; +var C = (function () { + function C() { + } + C.prototype.m1 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.prototype.m2 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.prototype.m3 = function () { + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.m4 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.m5 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.m6 = function () { + return __awaiter(this, void 0, missing_1.MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + return C; +}()); +var M; +(function (M) { + function f1() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + } + M.f1 = f1; +})(M || (M = {})); diff --git a/tests/baselines/reference/asyncAwait_es5.js b/tests/baselines/reference/asyncAwait_es5.js new file mode 100644 index 00000000000..e148de70ad2 --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es5.js @@ -0,0 +1,200 @@ +//// [asyncAwait_es5.ts] +type MyPromise = Promise; +declare var MyPromise: typeof Promise; +declare var p: Promise; +declare var mp: MyPromise; + +async function f0() { } +async function f1(): Promise { } +async function f3(): MyPromise { } + +let f4 = async function() { } +let f5 = async function(): Promise { } +let f6 = async function(): MyPromise { } + +let f7 = async () => { }; +let f8 = async (): Promise => { }; +let f9 = async (): MyPromise => { }; +let f10 = async () => p; +let f11 = async () => mp; +let f12 = async (): Promise => mp; +let f13 = async (): MyPromise => p; + +let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } +}; + +class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } +} + +module M { + export async function f1() { } +} + +//// [asyncAwait_es5.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f; + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (1) { + if (_.done) switch (op[0]) { + case 0: return { value: void 0, done: true }; + case 1: case 6: throw op[1]; + case 2: return { value: op[1], done: true }; + } + try { + switch (f = 1, op[0]) { + case 0: case 1: sent = op; break; + case 4: return _.label++, { value: op[1], done: false }; + case 7: op = _.stack.pop(), _.trys.pop(); continue; + default: + var r = _.trys.length > 0 && _.trys[_.trys.length - 1]; + if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; } + if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; } + if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; } + if (r[2]) { _.stack.pop(); } + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } + catch (e) { op = [6, e]; } + finally { f = 0, sent = void 0; } + } + } + return { + next: function (v) { return step([0, v]); }, + "throw": function (v) { return step([1, v]); }, + "return": function (v) { return step([2, v]); } + }; +}; +var _this = this; +function f0() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +} +function f1() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +} +function f3() { + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +} +var f4 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +}; +var f5 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +}; +var f6 = function () { + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +}; +var f7 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; +}); }); }; +var f8 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; +}); }); }; +var f9 = function () { return __awaiter(_this, void 0, MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; +}); }); }; +var f10 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, p]; +}); }); }; +var f11 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, mp]; +}); }); }; +var f12 = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/, mp]; +}); }); }; +var f13 = function () { return __awaiter(_this, void 0, MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/, p]; +}); }); }; +var o = { + m1: function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }, + m2: function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }, + m3: function () { + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + } +}; +var C = (function () { + function C() { + } + C.prototype.m1 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.prototype.m2 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.prototype.m3 = function () { + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.m4 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.m5 = function () { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + C.m6 = function () { + return __awaiter(this, void 0, MyPromise, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + return C; +}()); +var M; +(function (M) { + function f1() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + } + M.f1 = f1; +})(M || (M = {})); diff --git a/tests/baselines/reference/asyncAwait_es5.symbols b/tests/baselines/reference/asyncAwait_es5.symbols new file mode 100644 index 00000000000..2f80a025ade --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es5.symbols @@ -0,0 +1,118 @@ +=== tests/cases/conformance/async/es5/asyncAwait_es5.ts === +type MyPromise = Promise; +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) +>T : Symbol(T, Decl(asyncAwait_es5.ts, 0, 15)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>T : Symbol(T, Decl(asyncAwait_es5.ts, 0, 15)) + +declare var MyPromise: typeof Promise; +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare var p: Promise; +>p : Symbol(p, Decl(asyncAwait_es5.ts, 2, 11)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +declare var mp: MyPromise; +>mp : Symbol(mp, Decl(asyncAwait_es5.ts, 3, 11)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +async function f0() { } +>f0 : Symbol(f0, Decl(asyncAwait_es5.ts, 3, 34)) + +async function f1(): Promise { } +>f1 : Symbol(f1, Decl(asyncAwait_es5.ts, 5, 23)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +async function f3(): MyPromise { } +>f3 : Symbol(f3, Decl(asyncAwait_es5.ts, 6, 38)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +let f4 = async function() { } +>f4 : Symbol(f4, Decl(asyncAwait_es5.ts, 9, 3)) + +let f5 = async function(): Promise { } +>f5 : Symbol(f5, Decl(asyncAwait_es5.ts, 10, 3)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +let f6 = async function(): MyPromise { } +>f6 : Symbol(f6, Decl(asyncAwait_es5.ts, 11, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +let f7 = async () => { }; +>f7 : Symbol(f7, Decl(asyncAwait_es5.ts, 13, 3)) + +let f8 = async (): Promise => { }; +>f8 : Symbol(f8, Decl(asyncAwait_es5.ts, 14, 3)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +let f9 = async (): MyPromise => { }; +>f9 : Symbol(f9, Decl(asyncAwait_es5.ts, 15, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +let f10 = async () => p; +>f10 : Symbol(f10, Decl(asyncAwait_es5.ts, 16, 3)) +>p : Symbol(p, Decl(asyncAwait_es5.ts, 2, 11)) + +let f11 = async () => mp; +>f11 : Symbol(f11, Decl(asyncAwait_es5.ts, 17, 3)) +>mp : Symbol(mp, Decl(asyncAwait_es5.ts, 3, 11)) + +let f12 = async (): Promise => mp; +>f12 : Symbol(f12, Decl(asyncAwait_es5.ts, 18, 3)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>mp : Symbol(mp, Decl(asyncAwait_es5.ts, 3, 11)) + +let f13 = async (): MyPromise => p; +>f13 : Symbol(f13, Decl(asyncAwait_es5.ts, 19, 3)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) +>p : Symbol(p, Decl(asyncAwait_es5.ts, 2, 11)) + +let o = { +>o : Symbol(o, Decl(asyncAwait_es5.ts, 21, 3)) + + async m1() { }, +>m1 : Symbol(m1, Decl(asyncAwait_es5.ts, 21, 9)) + + async m2(): Promise { }, +>m2 : Symbol(m2, Decl(asyncAwait_es5.ts, 22, 16)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + async m3(): MyPromise { } +>m3 : Symbol(m3, Decl(asyncAwait_es5.ts, 23, 31)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + +}; + +class C { +>C : Symbol(C, Decl(asyncAwait_es5.ts, 25, 2)) + + async m1() { } +>m1 : Symbol(C.m1, Decl(asyncAwait_es5.ts, 27, 9)) + + async m2(): Promise { } +>m2 : Symbol(C.m2, Decl(asyncAwait_es5.ts, 28, 15)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + async m3(): MyPromise { } +>m3 : Symbol(C.m3, Decl(asyncAwait_es5.ts, 29, 30)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) + + static async m4() { } +>m4 : Symbol(C.m4, Decl(asyncAwait_es5.ts, 30, 32)) + + static async m5(): Promise { } +>m5 : Symbol(C.m5, Decl(asyncAwait_es5.ts, 31, 22)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + static async m6(): MyPromise { } +>m6 : Symbol(C.m6, Decl(asyncAwait_es5.ts, 32, 37)) +>MyPromise : Symbol(MyPromise, Decl(asyncAwait_es5.ts, 0, 0), Decl(asyncAwait_es5.ts, 1, 11)) +} + +module M { +>M : Symbol(M, Decl(asyncAwait_es5.ts, 34, 1)) + + export async function f1() { } +>f1 : Symbol(f1, Decl(asyncAwait_es5.ts, 36, 10)) +} diff --git a/tests/baselines/reference/asyncAwait_es5.types b/tests/baselines/reference/asyncAwait_es5.types new file mode 100644 index 00000000000..4162aa84b76 --- /dev/null +++ b/tests/baselines/reference/asyncAwait_es5.types @@ -0,0 +1,129 @@ +=== tests/cases/conformance/async/es5/asyncAwait_es5.ts === +type MyPromise = Promise; +>MyPromise : Promise +>T : T +>Promise : Promise +>T : T + +declare var MyPromise: typeof Promise; +>MyPromise : PromiseConstructor +>Promise : PromiseConstructor + +declare var p: Promise; +>p : Promise +>Promise : Promise + +declare var mp: MyPromise; +>mp : Promise +>MyPromise : Promise + +async function f0() { } +>f0 : () => Promise + +async function f1(): Promise { } +>f1 : () => Promise +>Promise : Promise + +async function f3(): MyPromise { } +>f3 : () => Promise +>MyPromise : Promise + +let f4 = async function() { } +>f4 : () => Promise +>async function() { } : () => Promise + +let f5 = async function(): Promise { } +>f5 : () => Promise +>async function(): Promise { } : () => Promise +>Promise : Promise + +let f6 = async function(): MyPromise { } +>f6 : () => Promise +>async function(): MyPromise { } : () => Promise +>MyPromise : Promise + +let f7 = async () => { }; +>f7 : () => Promise +>async () => { } : () => Promise + +let f8 = async (): Promise => { }; +>f8 : () => Promise +>async (): Promise => { } : () => Promise +>Promise : Promise + +let f9 = async (): MyPromise => { }; +>f9 : () => Promise +>async (): MyPromise => { } : () => Promise +>MyPromise : Promise + +let f10 = async () => p; +>f10 : () => Promise +>async () => p : () => Promise +>p : Promise + +let f11 = async () => mp; +>f11 : () => Promise +>async () => mp : () => Promise +>mp : Promise + +let f12 = async (): Promise => mp; +>f12 : () => Promise +>async (): Promise => mp : () => Promise +>Promise : Promise +>mp : Promise + +let f13 = async (): MyPromise => p; +>f13 : () => Promise +>async (): MyPromise => p : () => Promise +>MyPromise : Promise +>p : Promise + +let o = { +>o : { m1(): Promise; m2(): Promise; m3(): Promise; } +>{ async m1() { }, async m2(): Promise { }, async m3(): MyPromise { }} : { m1(): Promise; m2(): Promise; m3(): Promise; } + + async m1() { }, +>m1 : () => Promise + + async m2(): Promise { }, +>m2 : () => Promise +>Promise : Promise + + async m3(): MyPromise { } +>m3 : () => Promise +>MyPromise : Promise + +}; + +class C { +>C : C + + async m1() { } +>m1 : () => Promise + + async m2(): Promise { } +>m2 : () => Promise +>Promise : Promise + + async m3(): MyPromise { } +>m3 : () => Promise +>MyPromise : Promise + + static async m4() { } +>m4 : () => Promise + + static async m5(): Promise { } +>m5 : () => Promise +>Promise : Promise + + static async m6(): MyPromise { } +>m6 : () => Promise +>MyPromise : Promise +} + +module M { +>M : typeof M + + export async function f1() { } +>f1 : () => Promise +} diff --git a/tests/baselines/reference/asyncClass_es5.errors.txt b/tests/baselines/reference/asyncClass_es5.errors.txt new file mode 100644 index 00000000000..e8f4efd4f07 --- /dev/null +++ b/tests/baselines/reference/asyncClass_es5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/async/es5/asyncClass_es5.ts(1,1): error TS1042: 'async' modifier cannot be used here. + + +==== tests/cases/conformance/async/es5/asyncClass_es5.ts (1 errors) ==== + async class C { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncClass_es5.js b/tests/baselines/reference/asyncClass_es5.js new file mode 100644 index 00000000000..a552349118a --- /dev/null +++ b/tests/baselines/reference/asyncClass_es5.js @@ -0,0 +1,10 @@ +//// [asyncClass_es5.ts] +async class C { +} + +//// [asyncClass_es5.js] +var C = (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/asyncConstructor_es5.errors.txt b/tests/baselines/reference/asyncConstructor_es5.errors.txt new file mode 100644 index 00000000000..c24bf87ae67 --- /dev/null +++ b/tests/baselines/reference/asyncConstructor_es5.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/async/es5/asyncConstructor_es5.ts(2,3): error TS1089: 'async' modifier cannot appear on a constructor declaration. + + +==== tests/cases/conformance/async/es5/asyncConstructor_es5.ts (1 errors) ==== + class C { + async constructor() { + ~~~~~ +!!! error TS1089: 'async' modifier cannot appear on a constructor declaration. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncConstructor_es5.js b/tests/baselines/reference/asyncConstructor_es5.js new file mode 100644 index 00000000000..95470ccf9b0 --- /dev/null +++ b/tests/baselines/reference/asyncConstructor_es5.js @@ -0,0 +1,12 @@ +//// [asyncConstructor_es5.ts] +class C { + async constructor() { + } +} + +//// [asyncConstructor_es5.js] +var C = (function () { + function C() { + } + return C; +}()); diff --git a/tests/baselines/reference/asyncDeclare_es5.errors.txt b/tests/baselines/reference/asyncDeclare_es5.errors.txt new file mode 100644 index 00000000000..bfa467acca2 --- /dev/null +++ b/tests/baselines/reference/asyncDeclare_es5.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/async/es5/asyncDeclare_es5.ts(1,9): error TS1040: 'async' modifier cannot be used in an ambient context. + + +==== tests/cases/conformance/async/es5/asyncDeclare_es5.ts (1 errors) ==== + declare async function foo(): Promise; + ~~~~~ +!!! error TS1040: 'async' modifier cannot be used in an ambient context. \ No newline at end of file diff --git a/tests/baselines/reference/asyncDeclare_es5.js b/tests/baselines/reference/asyncDeclare_es5.js new file mode 100644 index 00000000000..80ee6017ad5 --- /dev/null +++ b/tests/baselines/reference/asyncDeclare_es5.js @@ -0,0 +1,4 @@ +//// [asyncDeclare_es5.ts] +declare async function foo(): Promise; + +//// [asyncDeclare_es5.js] diff --git a/tests/baselines/reference/asyncEnum_es5.errors.txt b/tests/baselines/reference/asyncEnum_es5.errors.txt new file mode 100644 index 00000000000..6029ae9c9d0 --- /dev/null +++ b/tests/baselines/reference/asyncEnum_es5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/async/es5/asyncEnum_es5.ts(1,1): error TS1042: 'async' modifier cannot be used here. + + +==== tests/cases/conformance/async/es5/asyncEnum_es5.ts (1 errors) ==== + async enum E { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + Value + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncEnum_es5.js b/tests/baselines/reference/asyncEnum_es5.js new file mode 100644 index 00000000000..d65b4bdb510 --- /dev/null +++ b/tests/baselines/reference/asyncEnum_es5.js @@ -0,0 +1,10 @@ +//// [asyncEnum_es5.ts] +async enum E { + Value +} + +//// [asyncEnum_es5.js] +var E; +(function (E) { + E[E["Value"] = 0] = "Value"; +})(E || (E = {})); diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es5.js b/tests/baselines/reference/asyncFunctionDeclaration11_es5.js index 166f4c9c5ca..27d16ebb0c1 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es5.js @@ -4,8 +4,8 @@ async function await(): Promise { //// [asyncFunctionDeclaration11_es5.js] function await() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration13_es5.js b/tests/baselines/reference/asyncFunctionDeclaration13_es5.js index 2ab2f5c7b7b..e097192fbbf 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration13_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration13_es5.js @@ -7,9 +7,9 @@ async function foo(): Promise { //// [asyncFunctionDeclaration13_es5.js] function foo() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var v; - return __generator(function (_a) { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es5.js b/tests/baselines/reference/asyncFunctionDeclaration14_es5.js index d0e747e0f84..5ef6ce61084 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es5.js @@ -5,8 +5,8 @@ async function foo(): Promise { //// [asyncFunctionDeclaration14_es5.js] function foo() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt index 752feb261b3..62c64f2cd54 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(6,16): error TS1055: Type '{}' is not a valid async function return type. -tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(7,16): error TS1055: Type 'any' is not a valid async function return type. -tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(8,16): error TS1055: Type 'number' is not a valid async function return type. -tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(9,16): error TS1055: Type 'PromiseLike' is not a valid async function return type. -tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,16): error TS1055: Type 'typeof Thenable' is not a valid async function return type. -tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,16): error TS1055: Type 'typeof Thenable' is not a valid async function return type. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(6,23): error TS1055: Type '{}' is not a valid async function return type. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(7,23): error TS1055: Type 'any' is not a valid async function return type. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(8,23): error TS1055: Type 'number' is not a valid async function return type. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(9,23): error TS1055: Type 'PromiseLike' is not a valid async function return type. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,23): error TS1055: Type 'typeof Thenable' is not a valid async function return type. +tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts(10,23): error TS1055: Type 'typeof Thenable' is not a valid async function return type. Type 'Thenable' is not assignable to type 'PromiseLike'. Types of property 'then' are incompatible. Type '() => void' is not assignable to type '{ (onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; (onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; }'. @@ -19,21 +19,21 @@ tests/cases/conformance/async/es5/functionDeclarations/asyncFunctionDeclaration1 declare let thenable: Thenable; async function fn1() { } // valid: Promise async function fn2(): { } { } // error - ~~~ + ~~~ !!! error TS1055: Type '{}' is not a valid async function return type. async function fn3(): any { } // error - ~~~ + ~~~ !!! error TS1055: Type 'any' is not a valid async function return type. async function fn4(): number { } // error - ~~~ + ~~~~~~ !!! error TS1055: Type 'number' is not a valid async function return type. async function fn5(): PromiseLike { } // error - ~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS1055: Type 'PromiseLike' is not a valid async function return type. async function fn6(): Thenable { } // error - ~~~ + ~~~~~~~~ !!! error TS1055: Type 'typeof Thenable' is not a valid async function return type. - ~~~ + ~~~~~~~~ !!! error TS1055: Type 'typeof Thenable' is not a valid async function return type. !!! error TS1055: Type 'Thenable' is not assignable to type 'PromiseLike'. !!! error TS1055: Types of property 'then' are incompatible. diff --git a/tests/baselines/reference/asyncFunctionDeclaration15_es5.js b/tests/baselines/reference/asyncFunctionDeclaration15_es5.js index 47e1fe45c80..5ca93d3eca8 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration15_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration15_es5.js @@ -26,72 +26,72 @@ async function fn19() { await thenable; } // error //// [asyncFunctionDeclaration15_es5.js] function fn1() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); } // valid: Promise function fn2() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); } // error function fn3() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); } // error function fn4() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); } // error function fn5() { - return __awaiter(this, void 0, PromiseLike, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); } // error function fn6() { - return __awaiter(this, void 0, Thenable, function () { return __generator(function (_a) { + return __awaiter(this, void 0, Thenable, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); } // error function fn7() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/]; }); }); } // valid: Promise function fn8() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, 1]; }); }); } // valid: Promise function fn9() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, null]; }); }); } // valid: Promise function fn10() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, undefined]; }); }); } // valid: Promise function fn11() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, a]; }); }); } // valid: Promise function fn12() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, obj]; }); }); } // valid: Promise<{ then: string; }> function fn13() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, thenable]; }); }); } // error function fn14() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, 1]; case 1: @@ -101,7 +101,7 @@ function fn14() { }); }); } // valid: Promise function fn15() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, null]; case 1: @@ -111,7 +111,7 @@ function fn15() { }); }); } // valid: Promise function fn16() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, undefined]; case 1: @@ -121,7 +121,7 @@ function fn16() { }); }); } // valid: Promise function fn17() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, a]; case 1: @@ -131,7 +131,7 @@ function fn17() { }); }); } // valid: Promise function fn18() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, obj]; case 1: @@ -141,7 +141,7 @@ function fn18() { }); }); } // valid: Promise function fn19() { - return __awaiter(this, void 0, void 0, function () { return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, thenable]; case 1: diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es5.js b/tests/baselines/reference/asyncFunctionDeclaration1_es5.js index 3f020ec6ece..913a0b3c4e2 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es5.js @@ -4,8 +4,8 @@ async function foo(): Promise { //// [asyncFunctionDeclaration1_es5.js] function foo() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration6_es5.js b/tests/baselines/reference/asyncFunctionDeclaration6_es5.js index 2ee26f29e62..282036f97de 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration6_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration6_es5.js @@ -5,8 +5,8 @@ async function foo(a = await): Promise { //// [asyncFunctionDeclaration6_es5.js] function foo(a) { if (a === void 0) { a = yield ; } - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration7_es5.js b/tests/baselines/reference/asyncFunctionDeclaration7_es5.js index 7bcf3be59ad..60dd0d6e3bf 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration7_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration7_es5.js @@ -7,17 +7,17 @@ async function bar(): Promise { //// [asyncFunctionDeclaration7_es5.js] function bar() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { // 'await' here is an identifier, and not a yield expression. function foo(a) { if (a === void 0) { a = yield ; } - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); } - return __generator(function (_a) { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js index 2da28f95cff..e35ec29595b 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js @@ -5,9 +5,9 @@ async function foo(): Promise { //// [asyncFunctionDeclaration9_es5.js] function foo() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var v, _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = {}; diff --git a/tests/baselines/reference/asyncGetter_es5.errors.txt b/tests/baselines/reference/asyncGetter_es5.errors.txt new file mode 100644 index 00000000000..fd3fba40a60 --- /dev/null +++ b/tests/baselines/reference/asyncGetter_es5.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/async/es5/asyncGetter_es5.ts(2,3): error TS1042: 'async' modifier cannot be used here. +tests/cases/conformance/async/es5/asyncGetter_es5.ts(2,13): error TS2378: A 'get' accessor must return a value. + + +==== tests/cases/conformance/async/es5/asyncGetter_es5.ts (2 errors) ==== + class C { + async get foo() { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + ~~~ +!!! error TS2378: A 'get' accessor must return a value. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncGetter_es5.js b/tests/baselines/reference/asyncGetter_es5.js new file mode 100644 index 00000000000..a9c7f6355d3 --- /dev/null +++ b/tests/baselines/reference/asyncGetter_es5.js @@ -0,0 +1,18 @@ +//// [asyncGetter_es5.ts] +class C { + async get foo() { + } +} + +//// [asyncGetter_es5.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "foo", { + get: function () { + }, + enumerable: true, + configurable: true + }); + return C; +}()); diff --git a/tests/baselines/reference/asyncImportedPromise_es5.js b/tests/baselines/reference/asyncImportedPromise_es5.js new file mode 100644 index 00000000000..54d1b0fdac8 --- /dev/null +++ b/tests/baselines/reference/asyncImportedPromise_es5.js @@ -0,0 +1,84 @@ +//// [tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts] //// + +//// [task.ts] +export class Task extends Promise { } + +//// [test.ts] +import { Task } from "./task"; +class Test { + async example(): Task { return; } +} + +//// [task.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var Task = (function (_super) { + __extends(Task, _super); + function Task() { + _super.apply(this, arguments); + } + return Task; +}(Promise)); +exports.Task = Task; +//// [test.js] +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f; + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (1) { + if (_.done) switch (op[0]) { + case 0: return { value: void 0, done: true }; + case 1: case 6: throw op[1]; + case 2: return { value: op[1], done: true }; + } + try { + switch (f = 1, op[0]) { + case 0: case 1: sent = op; break; + case 4: return _.label++, { value: op[1], done: false }; + case 7: op = _.stack.pop(), _.trys.pop(); continue; + default: + var r = _.trys.length > 0 && _.trys[_.trys.length - 1]; + if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; } + if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; } + if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; } + if (r[2]) { _.stack.pop(); } + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } + catch (e) { op = [6, e]; } + finally { f = 0, sent = void 0; } + } + } + return { + next: function (v) { return step([0, v]); }, + "throw": function (v) { return step([1, v]); }, + "return": function (v) { return step([2, v]); } + }; +}; +var task_1 = require("./task"); +var Test = (function () { + function Test() { + } + Test.prototype.example = function () { + return __awaiter(this, void 0, task_1.Task, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); + }; + return Test; +}()); diff --git a/tests/baselines/reference/asyncImportedPromise_es5.symbols b/tests/baselines/reference/asyncImportedPromise_es5.symbols new file mode 100644 index 00000000000..b889299bd7e --- /dev/null +++ b/tests/baselines/reference/asyncImportedPromise_es5.symbols @@ -0,0 +1,20 @@ +=== tests/cases/conformance/async/es5/task.ts === +export class Task extends Promise { } +>Task : Symbol(Task, Decl(task.ts, 0, 0)) +>T : Symbol(T, Decl(task.ts, 0, 18)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>T : Symbol(T, Decl(task.ts, 0, 18)) + +=== tests/cases/conformance/async/es5/test.ts === +import { Task } from "./task"; +>Task : Symbol(Task, Decl(test.ts, 0, 8)) + +class Test { +>Test : Symbol(Test, Decl(test.ts, 0, 30)) + + async example(): Task { return; } +>example : Symbol(Test.example, Decl(test.ts, 1, 12)) +>T : Symbol(T, Decl(test.ts, 2, 18)) +>Task : Symbol(Task, Decl(test.ts, 0, 8)) +>T : Symbol(T, Decl(test.ts, 2, 18)) +} diff --git a/tests/baselines/reference/asyncImportedPromise_es5.types b/tests/baselines/reference/asyncImportedPromise_es5.types new file mode 100644 index 00000000000..54a6e52fa17 --- /dev/null +++ b/tests/baselines/reference/asyncImportedPromise_es5.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/async/es5/task.ts === +export class Task extends Promise { } +>Task : Task +>T : T +>Promise : Promise +>T : T + +=== tests/cases/conformance/async/es5/test.ts === +import { Task } from "./task"; +>Task : typeof Task + +class Test { +>Test : Test + + async example(): Task { return; } +>example : () => Task +>T : T +>Task : Task +>T : T +} diff --git a/tests/baselines/reference/asyncInterface_es5.errors.txt b/tests/baselines/reference/asyncInterface_es5.errors.txt new file mode 100644 index 00000000000..30d2c554da7 --- /dev/null +++ b/tests/baselines/reference/asyncInterface_es5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/async/es5/asyncInterface_es5.ts(1,1): error TS1042: 'async' modifier cannot be used here. + + +==== tests/cases/conformance/async/es5/asyncInterface_es5.ts (1 errors) ==== + async interface I { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncInterface_es5.js b/tests/baselines/reference/asyncInterface_es5.js new file mode 100644 index 00000000000..280dade3869 --- /dev/null +++ b/tests/baselines/reference/asyncInterface_es5.js @@ -0,0 +1,5 @@ +//// [asyncInterface_es5.ts] +async interface I { +} + +//// [asyncInterface_es5.js] diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.js b/tests/baselines/reference/asyncMethodWithSuper_es5.js new file mode 100644 index 00000000000..87debbdc55c --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es5.js @@ -0,0 +1,106 @@ +//// [asyncMethodWithSuper_es5.ts] +class A { + x() { + } +} + +class B extends A { + // async method with only call/get on 'super' does not require a binding + async simple() { + // call with property access + super.x(); + + // call with element access + super["x"](); + + // property access (read) + const a = super.x; + + // element access (read) + const b = super["x"]; + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { + const f = () => {}; + + // call with property access + super.x(); + + // call with element access + super["x"](); + + // property access (read) + const a = super.x; + + // element access (read) + const b = super["x"]; + + // property access (assign) + super.x = f; + + // element access (assign) + super["x"] = f; + + // destructuring assign with property access + ({ f: super.x } = { f }); + + // destructuring assign with element access + ({ f: super["x"] } = { f }); + } +} + +//// [asyncMethodWithSuper_es5.js] +var A = (function () { + function A() { + } + A.prototype.x = function () { + }; + return A; +}()); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + // async method with only call/get on 'super' does not require a binding + B.prototype.simple = function () { + return __awaiter(this, void 0, void 0, function () { + var a, b; + return __generator(this, function (_a) { + // call with property access + _super.x.call(this); + // call with element access + _super["x"].call(this); + a = _super.x; + b = _super["x"]; + return [2 /*return*/]; + }); + }); + }; + // async method with assignment/destructuring on 'super' requires a binding + B.prototype.advanced = function () { + return __awaiter(this, void 0, void 0, function () { + var f, a, b, _a, _b; + return __generator(this, function (_c) { + f = function () { }; + // call with property access + _super.x.call(this); + // call with element access + _super["x"].call(this); + a = _super.x; + b = _super["x"]; + // property access (assign) + _super.x = f; + // element access (assign) + _super["x"] = f; + // destructuring assign with property access + (_a = { f: f }, super.x = _a.f, _a); + // destructuring assign with element access + (_b = { f: f }, super["x"] = _b.f, _b); + return [2 /*return*/]; + }); + }); + }; + return B; +}(A)); diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.symbols b/tests/baselines/reference/asyncMethodWithSuper_es5.symbols new file mode 100644 index 00000000000..e05f00a8e97 --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es5.symbols @@ -0,0 +1,102 @@ +=== tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts === +class A { +>A : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) + + x() { +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + } +} + +class B extends A { +>B : Symbol(B, Decl(asyncMethodWithSuper_es5.ts, 3, 1)) +>A : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) + + // async method with only call/get on 'super' does not require a binding + async simple() { +>simple : Symbol(B.simple, Decl(asyncMethodWithSuper_es5.ts, 5, 19)) + + // call with property access + super.x(); +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // call with element access + super["x"](); +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // property access (read) + const a = super.x; +>a : Symbol(a, Decl(asyncMethodWithSuper_es5.ts, 15, 13)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // element access (read) + const b = super["x"]; +>b : Symbol(b, Decl(asyncMethodWithSuper_es5.ts, 18, 13)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { +>advanced : Symbol(B.advanced, Decl(asyncMethodWithSuper_es5.ts, 19, 5)) + + const f = () => {}; +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 23, 13)) + + // call with property access + super.x(); +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // call with element access + super["x"](); +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // property access (read) + const a = super.x; +>a : Symbol(a, Decl(asyncMethodWithSuper_es5.ts, 32, 13)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // element access (read) + const b = super["x"]; +>b : Symbol(b, Decl(asyncMethodWithSuper_es5.ts, 35, 13)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) + + // property access (assign) + super.x = f; +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 23, 13)) + + // element access (assign) + super["x"] = f; +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 23, 13)) + + // destructuring assign with property access + ({ f: super.x } = { f }); +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 44, 10)) +>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>x : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 44, 27)) + + // destructuring assign with element access + ({ f: super["x"] } = { f }); +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 47, 10)) +>super : Symbol(A, Decl(asyncMethodWithSuper_es5.ts, 0, 0)) +>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es5.ts, 0, 9)) +>f : Symbol(f, Decl(asyncMethodWithSuper_es5.ts, 47, 30)) + } +} diff --git a/tests/baselines/reference/asyncMethodWithSuper_es5.types b/tests/baselines/reference/asyncMethodWithSuper_es5.types new file mode 100644 index 00000000000..4d14528409c --- /dev/null +++ b/tests/baselines/reference/asyncMethodWithSuper_es5.types @@ -0,0 +1,123 @@ +=== tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts === +class A { +>A : A + + x() { +>x : () => void + } +} + +class B extends A { +>B : B +>A : A + + // async method with only call/get on 'super' does not require a binding + async simple() { +>simple : () => Promise + + // call with property access + super.x(); +>super.x() : void +>super.x : () => void +>super : A +>x : () => void + + // call with element access + super["x"](); +>super["x"]() : void +>super["x"] : () => void +>super : A +>"x" : string + + // property access (read) + const a = super.x; +>a : () => void +>super.x : () => void +>super : A +>x : () => void + + // element access (read) + const b = super["x"]; +>b : () => void +>super["x"] : () => void +>super : A +>"x" : string + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { +>advanced : () => Promise + + const f = () => {}; +>f : () => void +>() => {} : () => void + + // call with property access + super.x(); +>super.x() : void +>super.x : () => void +>super : A +>x : () => void + + // call with element access + super["x"](); +>super["x"]() : void +>super["x"] : () => void +>super : A +>"x" : string + + // property access (read) + const a = super.x; +>a : () => void +>super.x : () => void +>super : A +>x : () => void + + // element access (read) + const b = super["x"]; +>b : () => void +>super["x"] : () => void +>super : A +>"x" : string + + // property access (assign) + super.x = f; +>super.x = f : () => void +>super.x : () => void +>super : A +>x : () => void +>f : () => void + + // element access (assign) + super["x"] = f; +>super["x"] = f : () => void +>super["x"] : () => void +>super : A +>"x" : string +>f : () => void + + // destructuring assign with property access + ({ f: super.x } = { f }); +>({ f: super.x } = { f }) : { f: () => void; } +>{ f: super.x } = { f } : { f: () => void; } +>{ f: super.x } : { f: () => void; } +>f : () => void +>super.x : () => void +>super : A +>x : () => void +>{ f } : { f: () => void; } +>f : () => void + + // destructuring assign with element access + ({ f: super["x"] } = { f }); +>({ f: super["x"] } = { f }) : { f: () => void; } +>{ f: super["x"] } = { f } : { f: () => void; } +>{ f: super["x"] } : { f: () => void; } +>f : () => void +>super["x"] : () => void +>super : A +>"x" : string +>{ f } : { f: () => void; } +>f : () => void + } +} diff --git a/tests/baselines/reference/asyncModule_es5.errors.txt b/tests/baselines/reference/asyncModule_es5.errors.txt new file mode 100644 index 00000000000..f3f1b588288 --- /dev/null +++ b/tests/baselines/reference/asyncModule_es5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/async/es5/asyncModule_es5.ts(1,1): error TS1042: 'async' modifier cannot be used here. + + +==== tests/cases/conformance/async/es5/asyncModule_es5.ts (1 errors) ==== + async module M { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncModule_es5.js b/tests/baselines/reference/asyncModule_es5.js new file mode 100644 index 00000000000..a3635646330 --- /dev/null +++ b/tests/baselines/reference/asyncModule_es5.js @@ -0,0 +1,5 @@ +//// [asyncModule_es5.ts] +async module M { +} + +//// [asyncModule_es5.js] diff --git a/tests/baselines/reference/asyncMultiFile_es5.js b/tests/baselines/reference/asyncMultiFile_es5.js new file mode 100644 index 00000000000..197127c5f10 --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile_es5.js @@ -0,0 +1,60 @@ +//// [tests/cases/conformance/async/es5/asyncMultiFile_es5.ts] //// + +//// [a.ts] +async function f() {} +//// [b.ts] +function g() { } + +//// [a.js] +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments)).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f; + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (1) { + if (_.done) switch (op[0]) { + case 0: return { value: void 0, done: true }; + case 1: case 6: throw op[1]; + case 2: return { value: op[1], done: true }; + } + try { + switch (f = 1, op[0]) { + case 0: case 1: sent = op; break; + case 4: return _.label++, { value: op[1], done: false }; + case 7: op = _.stack.pop(), _.trys.pop(); continue; + default: + var r = _.trys.length > 0 && _.trys[_.trys.length - 1]; + if (!r && (op[0] === 6 || op[0] === 2)) { _.done = 1; continue; } + if (op[0] === 3 && (!r || (op[1] > r[0] && op[1] < r[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < r[1]) { _.label = r[1], sent = op; break; } + if (r && _.label < r[2]) { _.label = r[2], _.stack.push(op); break; } + if (r[2]) { _.stack.pop(); } + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } + catch (e) { op = [6, e]; } + finally { f = 0, sent = void 0; } + } + } + return { + next: function (v) { return step([0, v]); }, + "throw": function (v) { return step([1, v]); }, + "return": function (v) { return step([2, v]); } + }; +}; +function f() { + return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { + return [2 /*return*/]; + }); }); +} +//// [b.js] +function g() { } diff --git a/tests/baselines/reference/asyncMultiFile_es5.symbols b/tests/baselines/reference/asyncMultiFile_es5.symbols new file mode 100644 index 00000000000..e8e5bf2850e --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile_es5.symbols @@ -0,0 +1,8 @@ +=== tests/cases/conformance/async/es5/a.ts === +async function f() {} +>f : Symbol(f, Decl(a.ts, 0, 0)) + +=== tests/cases/conformance/async/es5/b.ts === +function g() { } +>g : Symbol(g, Decl(b.ts, 0, 0)) + diff --git a/tests/baselines/reference/asyncMultiFile_es5.types b/tests/baselines/reference/asyncMultiFile_es5.types new file mode 100644 index 00000000000..52ca4f49e81 --- /dev/null +++ b/tests/baselines/reference/asyncMultiFile_es5.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/async/es5/a.ts === +async function f() {} +>f : () => Promise + +=== tests/cases/conformance/async/es5/b.ts === +function g() { } +>g : () => void + diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.js b/tests/baselines/reference/asyncQualifiedReturnType_es5.js new file mode 100644 index 00000000000..19de38325e2 --- /dev/null +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5.js @@ -0,0 +1,28 @@ +//// [asyncQualifiedReturnType_es5.ts] +namespace X { + export class MyPromise extends Promise { + } +} + +async function f(): X.MyPromise { +} + +//// [asyncQualifiedReturnType_es5.js] +var X; +(function (X) { + var MyPromise = (function (_super) { + __extends(MyPromise, _super); + function MyPromise() { + _super.apply(this, arguments); + } + return MyPromise; + }(Promise)); + X.MyPromise = MyPromise; +})(X || (X = {})); +function f() { + return __awaiter(this, void 0, X.MyPromise, function () { + return __generator(this, function (_a) { + return [2 /*return*/]; + }); + }); +} diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.symbols b/tests/baselines/reference/asyncQualifiedReturnType_es5.symbols new file mode 100644 index 00000000000..1fcc5d4e609 --- /dev/null +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5.symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts === +namespace X { +>X : Symbol(X, Decl(asyncQualifiedReturnType_es5.ts, 0, 0)) + + export class MyPromise extends Promise { +>MyPromise : Symbol(MyPromise, Decl(asyncQualifiedReturnType_es5.ts, 0, 13)) +>T : Symbol(T, Decl(asyncQualifiedReturnType_es5.ts, 1, 27)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>T : Symbol(T, Decl(asyncQualifiedReturnType_es5.ts, 1, 27)) + } +} + +async function f(): X.MyPromise { +>f : Symbol(f, Decl(asyncQualifiedReturnType_es5.ts, 3, 1)) +>X : Symbol(X, Decl(asyncQualifiedReturnType_es5.ts, 0, 0)) +>MyPromise : Symbol(X.MyPromise, Decl(asyncQualifiedReturnType_es5.ts, 0, 13)) +} diff --git a/tests/baselines/reference/asyncQualifiedReturnType_es5.types b/tests/baselines/reference/asyncQualifiedReturnType_es5.types new file mode 100644 index 00000000000..2fccf45f2a4 --- /dev/null +++ b/tests/baselines/reference/asyncQualifiedReturnType_es5.types @@ -0,0 +1,17 @@ +=== tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts === +namespace X { +>X : typeof X + + export class MyPromise extends Promise { +>MyPromise : MyPromise +>T : T +>Promise : Promise +>T : T + } +} + +async function f(): X.MyPromise { +>f : () => X.MyPromise +>X : any +>MyPromise : X.MyPromise +} diff --git a/tests/baselines/reference/asyncSetter_es5.errors.txt b/tests/baselines/reference/asyncSetter_es5.errors.txt new file mode 100644 index 00000000000..59557ec9313 --- /dev/null +++ b/tests/baselines/reference/asyncSetter_es5.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/async/es5/asyncSetter_es5.ts(2,3): error TS1042: 'async' modifier cannot be used here. + + +==== tests/cases/conformance/async/es5/asyncSetter_es5.ts (1 errors) ==== + class C { + async set foo(value) { + ~~~~~ +!!! error TS1042: 'async' modifier cannot be used here. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/asyncSetter_es5.js b/tests/baselines/reference/asyncSetter_es5.js new file mode 100644 index 00000000000..a260ae67bd1 --- /dev/null +++ b/tests/baselines/reference/asyncSetter_es5.js @@ -0,0 +1,18 @@ +//// [asyncSetter_es5.ts] +class C { + async set foo(value) { + } +} + +//// [asyncSetter_es5.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "foo", { + set: function (value) { + }, + enumerable: true, + configurable: true + }); + return C; +}()); diff --git a/tests/baselines/reference/asyncUseStrict_es5.js b/tests/baselines/reference/asyncUseStrict_es5.js new file mode 100644 index 00000000000..0a1b61b96d8 --- /dev/null +++ b/tests/baselines/reference/asyncUseStrict_es5.js @@ -0,0 +1,23 @@ +//// [asyncUseStrict_es5.ts] +declare var a: boolean; +declare var p: Promise; +async function func(): Promise { + "use strict"; + var b = await p || a; +} + +//// [asyncUseStrict_es5.js] +function func() { + "use strict"; + return __awaiter(this, void 0, void 0, function () { + var b; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, p]; + case 1: + b = (_a.sent()) || a; + return [2 /*return*/]; + } + }); + }); +} diff --git a/tests/baselines/reference/asyncUseStrict_es5.symbols b/tests/baselines/reference/asyncUseStrict_es5.symbols new file mode 100644 index 00000000000..a70f3ca546a --- /dev/null +++ b/tests/baselines/reference/asyncUseStrict_es5.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/async/es5/asyncUseStrict_es5.ts === +declare var a: boolean; +>a : Symbol(a, Decl(asyncUseStrict_es5.ts, 0, 11)) + +declare var p: Promise; +>p : Symbol(p, Decl(asyncUseStrict_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + +async function func(): Promise { +>func : Symbol(func, Decl(asyncUseStrict_es5.ts, 1, 32)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + "use strict"; + var b = await p || a; +>b : Symbol(b, Decl(asyncUseStrict_es5.ts, 4, 7)) +>p : Symbol(p, Decl(asyncUseStrict_es5.ts, 1, 11)) +>a : Symbol(a, Decl(asyncUseStrict_es5.ts, 0, 11)) +} diff --git a/tests/baselines/reference/asyncUseStrict_es5.types b/tests/baselines/reference/asyncUseStrict_es5.types new file mode 100644 index 00000000000..c7eafb3433c --- /dev/null +++ b/tests/baselines/reference/asyncUseStrict_es5.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/async/es5/asyncUseStrict_es5.ts === +declare var a: boolean; +>a : boolean + +declare var p: Promise; +>p : Promise +>Promise : Promise + +async function func(): Promise { +>func : () => Promise +>Promise : Promise + + "use strict"; +>"use strict" : string + + var b = await p || a; +>b : boolean +>await p || a : boolean +>await p : boolean +>p : Promise +>a : boolean +} diff --git a/tests/baselines/reference/awaitBinaryExpression1_es5.js b/tests/baselines/reference/awaitBinaryExpression1_es5.js index c0202d41dad..41b090d2c46 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression1_es5.js @@ -11,9 +11,9 @@ async function func(): Promise { //// [awaitBinaryExpression1_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitBinaryExpression2_es5.js b/tests/baselines/reference/awaitBinaryExpression2_es5.js index 8484a9a3268..dd84d069c27 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression2_es5.js @@ -11,9 +11,9 @@ async function func(): Promise { //// [awaitBinaryExpression2_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitBinaryExpression3_es5.js b/tests/baselines/reference/awaitBinaryExpression3_es5.js index 3403749814a..0c301dec2c8 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression3_es5.js @@ -11,9 +11,9 @@ async function func(): Promise { //// [awaitBinaryExpression3_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitBinaryExpression4_es5.js b/tests/baselines/reference/awaitBinaryExpression4_es5.js index 6a67eefac33..26c0e5de5f1 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression4_es5.js @@ -11,9 +11,9 @@ async function func(): Promise { //// [awaitBinaryExpression4_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitBinaryExpression5_es5.js b/tests/baselines/reference/awaitBinaryExpression5_es5.js index 5064e72bd5e..4e07e40a174 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es5.js +++ b/tests/baselines/reference/awaitBinaryExpression5_es5.js @@ -12,9 +12,9 @@ async function func(): Promise { //// [awaitBinaryExpression5_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var o, _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitCallExpression1_es5.js b/tests/baselines/reference/awaitCallExpression1_es5.js index d1f1a5ea7b1..dfc0e2cbd84 100644 --- a/tests/baselines/reference/awaitCallExpression1_es5.js +++ b/tests/baselines/reference/awaitCallExpression1_es5.js @@ -15,9 +15,9 @@ async function func(): Promise { //// [awaitCallExpression1_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { before(); b = fn(a, a, a); after(); diff --git a/tests/baselines/reference/awaitCallExpression2_es5.js b/tests/baselines/reference/awaitCallExpression2_es5.js index 399dead0084..6b0d6e4b648 100644 --- a/tests/baselines/reference/awaitCallExpression2_es5.js +++ b/tests/baselines/reference/awaitCallExpression2_es5.js @@ -15,9 +15,9 @@ async function func(): Promise { //// [awaitCallExpression2_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b, _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitCallExpression3_es5.js b/tests/baselines/reference/awaitCallExpression3_es5.js index 5b14075a373..685616b23dd 100644 --- a/tests/baselines/reference/awaitCallExpression3_es5.js +++ b/tests/baselines/reference/awaitCallExpression3_es5.js @@ -15,9 +15,9 @@ async function func(): Promise { //// [awaitCallExpression3_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b, _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitCallExpression4_es5.js b/tests/baselines/reference/awaitCallExpression4_es5.js index 8202598b828..88c3cea35bd 100644 --- a/tests/baselines/reference/awaitCallExpression4_es5.js +++ b/tests/baselines/reference/awaitCallExpression4_es5.js @@ -15,9 +15,9 @@ async function func(): Promise { //// [awaitCallExpression4_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitCallExpression5_es5.js b/tests/baselines/reference/awaitCallExpression5_es5.js index 387dabc1df3..72c0e200c8d 100644 --- a/tests/baselines/reference/awaitCallExpression5_es5.js +++ b/tests/baselines/reference/awaitCallExpression5_es5.js @@ -15,9 +15,9 @@ async function func(): Promise { //// [awaitCallExpression5_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { before(); b = o.fn(a, a, a); after(); diff --git a/tests/baselines/reference/awaitCallExpression6_es5.js b/tests/baselines/reference/awaitCallExpression6_es5.js index 3c2910135e7..acc4261eacb 100644 --- a/tests/baselines/reference/awaitCallExpression6_es5.js +++ b/tests/baselines/reference/awaitCallExpression6_es5.js @@ -15,9 +15,9 @@ async function func(): Promise { //// [awaitCallExpression6_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b, _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitCallExpression7_es5.js b/tests/baselines/reference/awaitCallExpression7_es5.js index 0f3056e48fa..dd69abc0514 100644 --- a/tests/baselines/reference/awaitCallExpression7_es5.js +++ b/tests/baselines/reference/awaitCallExpression7_es5.js @@ -15,9 +15,9 @@ async function func(): Promise { //// [awaitCallExpression7_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b, _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitCallExpression8_es5.js b/tests/baselines/reference/awaitCallExpression8_es5.js index bcb7a7f8d7b..6d7d5dceba9 100644 --- a/tests/baselines/reference/awaitCallExpression8_es5.js +++ b/tests/baselines/reference/awaitCallExpression8_es5.js @@ -15,9 +15,9 @@ async function func(): Promise { //// [awaitCallExpression8_es5.js] function func() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: before(); diff --git a/tests/baselines/reference/awaitClassExpression_es5.js b/tests/baselines/reference/awaitClassExpression_es5.js new file mode 100644 index 00000000000..9123f5f2ea8 --- /dev/null +++ b/tests/baselines/reference/awaitClassExpression_es5.js @@ -0,0 +1,31 @@ +//// [awaitClassExpression_es5.ts] +declare class C { } +declare var p: Promise; + +async function func(): Promise { + class D extends (await p) { + } +} + +//// [awaitClassExpression_es5.js] +function func() { + return __awaiter(this, void 0, void 0, function () { + var D, _a, _b; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + _a = function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + return D; + }; + return [4 /*yield*/, p]; + case 1: + D = (_a.apply(void 0, [(_c.sent())])); + return [2 /*return*/]; + } + }); + }); +} diff --git a/tests/baselines/reference/awaitClassExpression_es5.symbols b/tests/baselines/reference/awaitClassExpression_es5.symbols new file mode 100644 index 00000000000..1f550576c09 --- /dev/null +++ b/tests/baselines/reference/awaitClassExpression_es5.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/async/es5/awaitClassExpression_es5.ts === +declare class C { } +>C : Symbol(C, Decl(awaitClassExpression_es5.ts, 0, 0)) + +declare var p: Promise; +>p : Symbol(p, Decl(awaitClassExpression_es5.ts, 1, 11)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) +>C : Symbol(C, Decl(awaitClassExpression_es5.ts, 0, 0)) + +async function func(): Promise { +>func : Symbol(func, Decl(awaitClassExpression_es5.ts, 1, 33)) +>Promise : Symbol(Promise, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) + + class D extends (await p) { +>D : Symbol(D, Decl(awaitClassExpression_es5.ts, 3, 38)) +>p : Symbol(p, Decl(awaitClassExpression_es5.ts, 1, 11)) + } +} diff --git a/tests/baselines/reference/awaitClassExpression_es5.types b/tests/baselines/reference/awaitClassExpression_es5.types new file mode 100644 index 00000000000..e1f4bf8f82e --- /dev/null +++ b/tests/baselines/reference/awaitClassExpression_es5.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/async/es5/awaitClassExpression_es5.ts === +declare class C { } +>C : C + +declare var p: Promise; +>p : Promise +>Promise : Promise +>C : typeof C + +async function func(): Promise { +>func : () => Promise +>Promise : Promise + + class D extends (await p) { +>D : D +>(await p) : C +>await p : typeof C +>p : Promise + } +} diff --git a/tests/baselines/reference/awaitUnion_es5.js b/tests/baselines/reference/awaitUnion_es5.js new file mode 100644 index 00000000000..e4ebaa4f62e --- /dev/null +++ b/tests/baselines/reference/awaitUnion_es5.js @@ -0,0 +1,40 @@ +//// [awaitUnion_es5.ts] +declare let a: number | string; +declare let b: PromiseLike | PromiseLike; +declare let c: PromiseLike; +declare let d: number | PromiseLike; +declare let e: number | PromiseLike; +async function f() { + let await_a = await a; + let await_b = await b; + let await_c = await c; + let await_d = await d; + let await_e = await e; +} + +//// [awaitUnion_es5.js] +function f() { + return __awaiter(this, void 0, void 0, function () { + var await_a, await_b, await_c, await_d, await_e; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, a]; + case 1: + await_a = _a.sent(); + return [4 /*yield*/, b]; + case 2: + await_b = _a.sent(); + return [4 /*yield*/, c]; + case 3: + await_c = _a.sent(); + return [4 /*yield*/, d]; + case 4: + await_d = _a.sent(); + return [4 /*yield*/, e]; + case 5: + await_e = _a.sent(); + return [2 /*return*/]; + } + }); + }); +} diff --git a/tests/baselines/reference/awaitUnion_es5.symbols b/tests/baselines/reference/awaitUnion_es5.symbols new file mode 100644 index 00000000000..b8fb6dbed38 --- /dev/null +++ b/tests/baselines/reference/awaitUnion_es5.symbols @@ -0,0 +1,44 @@ +=== tests/cases/conformance/async/es5/awaitUnion_es5.ts === +declare let a: number | string; +>a : Symbol(a, Decl(awaitUnion_es5.ts, 0, 11)) + +declare let b: PromiseLike | PromiseLike; +>b : Symbol(b, Decl(awaitUnion_es5.ts, 1, 11)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +declare let c: PromiseLike; +>c : Symbol(c, Decl(awaitUnion_es5.ts, 2, 11)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +declare let d: number | PromiseLike; +>d : Symbol(d, Decl(awaitUnion_es5.ts, 3, 11)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +declare let e: number | PromiseLike; +>e : Symbol(e, Decl(awaitUnion_es5.ts, 4, 11)) +>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --)) + +async function f() { +>f : Symbol(f, Decl(awaitUnion_es5.ts, 4, 53)) + + let await_a = await a; +>await_a : Symbol(await_a, Decl(awaitUnion_es5.ts, 6, 4)) +>a : Symbol(a, Decl(awaitUnion_es5.ts, 0, 11)) + + let await_b = await b; +>await_b : Symbol(await_b, Decl(awaitUnion_es5.ts, 7, 4)) +>b : Symbol(b, Decl(awaitUnion_es5.ts, 1, 11)) + + let await_c = await c; +>await_c : Symbol(await_c, Decl(awaitUnion_es5.ts, 8, 4)) +>c : Symbol(c, Decl(awaitUnion_es5.ts, 2, 11)) + + let await_d = await d; +>await_d : Symbol(await_d, Decl(awaitUnion_es5.ts, 9, 4)) +>d : Symbol(d, Decl(awaitUnion_es5.ts, 3, 11)) + + let await_e = await e; +>await_e : Symbol(await_e, Decl(awaitUnion_es5.ts, 10, 4)) +>e : Symbol(e, Decl(awaitUnion_es5.ts, 4, 11)) +} diff --git a/tests/baselines/reference/awaitUnion_es5.types b/tests/baselines/reference/awaitUnion_es5.types new file mode 100644 index 00000000000..fa68780e72d --- /dev/null +++ b/tests/baselines/reference/awaitUnion_es5.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/async/es5/awaitUnion_es5.ts === +declare let a: number | string; +>a : number | string + +declare let b: PromiseLike | PromiseLike; +>b : PromiseLike | PromiseLike +>PromiseLike : PromiseLike +>PromiseLike : PromiseLike + +declare let c: PromiseLike; +>c : PromiseLike +>PromiseLike : PromiseLike + +declare let d: number | PromiseLike; +>d : number | PromiseLike +>PromiseLike : PromiseLike + +declare let e: number | PromiseLike; +>e : number | PromiseLike +>PromiseLike : PromiseLike + +async function f() { +>f : () => Promise + + let await_a = await a; +>await_a : number | string +>await a : number | string +>a : number | string + + let await_b = await b; +>await_b : number | string +>await b : number | string +>b : PromiseLike | PromiseLike + + let await_c = await c; +>await_c : number | string +>await c : number | string +>c : PromiseLike + + let await_d = await d; +>await_d : number | string +>await d : number | string +>d : number | PromiseLike + + let await_e = await e; +>await_e : number | string +>await e : number | string +>e : number | PromiseLike +} diff --git a/tests/baselines/reference/es5-asyncFunction.js b/tests/baselines/reference/es5-asyncFunction.js index 57c9a7c05f6..9cb6f1d3674 100644 --- a/tests/baselines/reference/es5-asyncFunction.js +++ b/tests/baselines/reference/es5-asyncFunction.js @@ -17,7 +17,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments)).next()); }); }; -var __generator = (this && this.__generator) || function (body) { +var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f; function step(op) { if (f) throw new TypeError("Generator is already executing."); @@ -42,7 +42,7 @@ var __generator = (this && this.__generator) || function (body) { _.trys.pop(); continue; } - op = body(_); + op = body.call(thisArg, _); } catch (e) { op = [6, e]; } finally { f = 0, sent = void 0; } @@ -56,14 +56,14 @@ var __generator = (this && this.__generator) || function (body) { }; function empty() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); } function singleAwait() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: diff --git a/tests/baselines/reference/es5-asyncFunctionArrayLiterals.js b/tests/baselines/reference/es5-asyncFunctionArrayLiterals.js index 936e530ee2b..c8a4733aa94 100644 --- a/tests/baselines/reference/es5-asyncFunctionArrayLiterals.js +++ b/tests/baselines/reference/es5-asyncFunctionArrayLiterals.js @@ -37,7 +37,7 @@ async function arrayLiteral7() { function arrayLiteral0() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, y]; case 1: @@ -50,7 +50,7 @@ function arrayLiteral0() { function arrayLiteral1() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = [y]; @@ -64,7 +64,7 @@ function arrayLiteral1() { } function arrayLiteral2() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, y]; case 1: @@ -77,7 +77,7 @@ function arrayLiteral2() { function arrayLiteral3() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d; - return __generator(function (_e) { + return __generator(this, function (_e) { switch (_e.label) { case 0: _b = (_a = y).concat; @@ -92,7 +92,7 @@ function arrayLiteral3() { function arrayLiteral4() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, y]; case 1: @@ -105,7 +105,7 @@ function arrayLiteral4() { function arrayLiteral5() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = [y]).concat; @@ -120,7 +120,7 @@ function arrayLiteral5() { function arrayLiteral6() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = [y]; @@ -135,7 +135,7 @@ function arrayLiteral6() { function arrayLiteral7() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, y]; case 1: diff --git a/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js b/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js index 936ca033954..a7aff630256 100644 --- a/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js +++ b/tests/baselines/reference/es5-asyncFunctionBinaryExpressions.js @@ -125,7 +125,7 @@ async function binaryComma1(): Promise { //// [es5-asyncFunctionBinaryExpressions.js] function binaryPlus0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -138,7 +138,7 @@ function binaryPlus0() { function binaryPlus1() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -152,7 +152,7 @@ function binaryPlus1() { } function binaryLogicalAnd0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -165,7 +165,7 @@ function binaryLogicalAnd0() { function binaryLogicalAnd1() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -184,7 +184,7 @@ function binaryLogicalAnd1() { } function binaryAssignment0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, y]; case 1: @@ -197,7 +197,7 @@ function binaryAssignment0() { function binaryAssignment1() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -212,7 +212,7 @@ function binaryAssignment1() { function binaryAssignment2() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x.a; @@ -227,7 +227,7 @@ function binaryAssignment2() { function binaryAssignment3() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = x; @@ -243,7 +243,7 @@ function binaryAssignment3() { function binaryAssignment4() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x[z]; @@ -258,7 +258,7 @@ function binaryAssignment4() { function binaryAssignment5() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = x.a; @@ -273,7 +273,7 @@ function binaryAssignment5() { } function binaryAssignment6() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -285,7 +285,7 @@ function binaryAssignment6() { } function binaryAssignment7() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x.a]; case 1: @@ -297,7 +297,7 @@ function binaryAssignment7() { } function binaryAssignment8() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -310,7 +310,7 @@ function binaryAssignment8() { function binaryAssignment9() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -325,7 +325,7 @@ function binaryAssignment9() { function binaryAssignment10() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -339,7 +339,7 @@ function binaryAssignment10() { } function binaryAssignment11() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x[z]]; case 1: @@ -352,7 +352,7 @@ function binaryAssignment11() { function binaryAssignment12() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x.a; @@ -366,7 +366,7 @@ function binaryAssignment12() { } function binaryAssignment13() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x.a]; case 1: @@ -379,7 +379,7 @@ function binaryAssignment13() { function binaryCompoundAssignment0() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -394,7 +394,7 @@ function binaryCompoundAssignment0() { function binaryCompoundAssignment1() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = x; @@ -410,7 +410,7 @@ function binaryCompoundAssignment1() { function binaryCompoundAssignment2() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _a = x; @@ -426,7 +426,7 @@ function binaryCompoundAssignment2() { } function binaryCompoundAssignment3() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -438,7 +438,7 @@ function binaryCompoundAssignment3() { } function binaryCompoundAssignment4() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -451,7 +451,7 @@ function binaryCompoundAssignment4() { function binaryCompoundAssignment5() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -466,7 +466,7 @@ function binaryCompoundAssignment5() { function binaryCompoundAssignment6() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -483,7 +483,7 @@ function binaryCompoundAssignment6() { function binaryCompoundAssignment7() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -501,7 +501,7 @@ function binaryCompoundAssignment7() { function binaryCompoundAssignment8() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _a = x; @@ -520,7 +520,7 @@ function binaryCompoundAssignment8() { function binaryExponentiation() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d, _e, _f; - return __generator(function (_g) { + return __generator(this, function (_g) { switch (_g.label) { case 0: _b = (_a = Math).pow; @@ -539,7 +539,7 @@ function binaryExponentiation() { } function binaryComma0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: return [2 /*return*/, ((_a.sent()), y)]; @@ -548,8 +548,8 @@ function binaryComma0() { }); } function binaryComma1() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { switch (_a.label) { case 0: x; diff --git a/tests/baselines/reference/es5-asyncFunctionCallExpressions.js b/tests/baselines/reference/es5-asyncFunctionCallExpressions.js index 8f0d17e7c14..93c4dcfd3cb 100644 --- a/tests/baselines/reference/es5-asyncFunctionCallExpressions.js +++ b/tests/baselines/reference/es5-asyncFunctionCallExpressions.js @@ -89,7 +89,7 @@ async function callExpression20() { //// [es5-asyncFunctionCallExpressions.js] function callExpression0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x(y, z)]; case 1: @@ -101,7 +101,7 @@ function callExpression0() { } function callExpression1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -114,7 +114,7 @@ function callExpression1() { function callExpression2() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = x; @@ -129,7 +129,7 @@ function callExpression2() { function callExpression3() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = x; @@ -144,7 +144,7 @@ function callExpression3() { } function callExpression4() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x.apply(void 0, y.concat([z]))]; case 1: @@ -156,7 +156,7 @@ function callExpression4() { } function callExpression5() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -169,7 +169,7 @@ function callExpression5() { function callExpression6() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x).apply; @@ -185,7 +185,7 @@ function callExpression6() { function callExpression7() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d, _e, _f, _g; - return __generator(function (_h) { + return __generator(this, function (_h) { switch (_h.label) { case 0: _b = (_a = x).apply; @@ -202,7 +202,7 @@ function callExpression7() { function callExpression8() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d; - return __generator(function (_e) { + return __generator(this, function (_e) { switch (_e.label) { case 0: _b = (_a = x).apply; @@ -218,7 +218,7 @@ function callExpression8() { function callExpression9() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d, _e, _f; - return __generator(function (_g) { + return __generator(this, function (_g) { switch (_g.label) { case 0: _b = (_a = x).apply; @@ -234,7 +234,7 @@ function callExpression9() { } function callExpression10() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x.a(y, z)]; case 1: @@ -246,7 +246,7 @@ function callExpression10() { } function callExpression11() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x.a]; case 1: @@ -258,7 +258,7 @@ function callExpression11() { } function callExpression12() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -271,7 +271,7 @@ function callExpression12() { function callExpression13() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x).a; @@ -286,7 +286,7 @@ function callExpression13() { function callExpression14() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x).a; @@ -301,7 +301,7 @@ function callExpression14() { } function callExpression15() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x[a](y, z)]; case 1: @@ -313,7 +313,7 @@ function callExpression15() { } function callExpression16() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x[a]]; case 1: @@ -325,7 +325,7 @@ function callExpression16() { } function callExpression17() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -338,7 +338,7 @@ function callExpression17() { function callExpression18() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -353,7 +353,7 @@ function callExpression18() { function callExpression19() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x)[a]; @@ -368,7 +368,7 @@ function callExpression19() { function callExpression20() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x)[a]; diff --git a/tests/baselines/reference/es5-asyncFunctionConditionals.js b/tests/baselines/reference/es5-asyncFunctionConditionals.js index f559e1f962d..b42b0c07b0a 100644 --- a/tests/baselines/reference/es5-asyncFunctionConditionals.js +++ b/tests/baselines/reference/es5-asyncFunctionConditionals.js @@ -16,7 +16,7 @@ async function conditional2() { //// [es5-asyncFunctionConditionals.js] function conditional0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -29,7 +29,7 @@ function conditional0() { function conditional1() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: if (!x) @@ -51,7 +51,7 @@ function conditional1() { function conditional2() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: if (!x) diff --git a/tests/baselines/reference/es5-asyncFunctionDoStatements.js b/tests/baselines/reference/es5-asyncFunctionDoStatements.js index f2052ab378d..7151446dddf 100644 --- a/tests/baselines/reference/es5-asyncFunctionDoStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionDoStatements.js @@ -80,7 +80,7 @@ async function doStatement18() { //// [es5-asyncFunctionDoStatements.js] function doStatement0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { do { x; } while (y); @@ -90,7 +90,7 @@ function doStatement0() { } function doStatement1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -107,7 +107,7 @@ function doStatement1() { } function doStatement2() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: x; @@ -124,7 +124,7 @@ function doStatement2() { } function doStatement3() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { do { continue; } while (y); @@ -134,7 +134,7 @@ function doStatement3() { } function doStatement4() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -151,7 +151,7 @@ function doStatement4() { } function doStatement5() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (1) @@ -171,7 +171,7 @@ function doStatement5() { } function doStatement6() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [3 /*break*/, 1]; case 1: return [4 /*yield*/, y]; @@ -186,7 +186,7 @@ function doStatement6() { } function doStatement7() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { A: do { continue A; } while (y); @@ -196,7 +196,7 @@ function doStatement7() { } function doStatement8() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -213,7 +213,7 @@ function doStatement8() { } function doStatement9() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (1) @@ -233,7 +233,7 @@ function doStatement9() { } function doStatement10() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [3 /*break*/, 1]; case 1: return [4 /*yield*/, y]; @@ -248,7 +248,7 @@ function doStatement10() { } function doStatement11() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { do { break; } while (y); @@ -258,7 +258,7 @@ function doStatement11() { } function doStatement12() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -275,7 +275,7 @@ function doStatement12() { } function doStatement13() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (1) @@ -295,7 +295,7 @@ function doStatement13() { } function doStatement14() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [3 /*break*/, 3]; case 1: return [4 /*yield*/, y]; @@ -310,7 +310,7 @@ function doStatement14() { } function doStatement15() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { E: do { break E; } while (y); @@ -320,7 +320,7 @@ function doStatement15() { } function doStatement16() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -337,7 +337,7 @@ function doStatement16() { } function doStatement17() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (1) @@ -357,7 +357,7 @@ function doStatement17() { } function doStatement18() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [3 /*break*/, 3]; case 1: return [4 /*yield*/, y]; diff --git a/tests/baselines/reference/es5-asyncFunctionElementAccess.js b/tests/baselines/reference/es5-asyncFunctionElementAccess.js index 4595cc219e9..56c9b54644b 100644 --- a/tests/baselines/reference/es5-asyncFunctionElementAccess.js +++ b/tests/baselines/reference/es5-asyncFunctionElementAccess.js @@ -17,7 +17,7 @@ async function elementAccess2() { //// [es5-asyncFunctionElementAccess.js] function elementAccess0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x[y]]; case 1: @@ -29,7 +29,7 @@ function elementAccess0() { } function elementAccess1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -42,7 +42,7 @@ function elementAccess1() { function elementAccess2() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; diff --git a/tests/baselines/reference/es5-asyncFunctionForInStatements.js b/tests/baselines/reference/es5-asyncFunctionForInStatements.js index 4ce6e5e4a19..30946fca56d 100644 --- a/tests/baselines/reference/es5-asyncFunctionForInStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForInStatements.js @@ -40,7 +40,7 @@ async function forInStatement8() { //// [es5-asyncFunctionForInStatements.js] function forInStatement0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { for (x in y) { z; } @@ -51,7 +51,7 @@ function forInStatement0() { function forInStatement1() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _i; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = []; @@ -78,7 +78,7 @@ function forInStatement1() { function forInStatement2() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _i; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = []; @@ -105,7 +105,7 @@ function forInStatement2() { function forInStatement3() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _i; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = []; @@ -132,7 +132,7 @@ function forInStatement3() { function forInStatement4() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _i; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = []; @@ -159,7 +159,7 @@ function forInStatement4() { function forInStatement5() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _i; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = []; @@ -186,7 +186,7 @@ function forInStatement5() { function forInStatement6() { return __awaiter(this, void 0, void 0, function () { var a; - return __generator(function (_a) { + return __generator(this, function (_a) { for (a in y) { z; } @@ -197,7 +197,7 @@ function forInStatement6() { function forInStatement7() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _i, b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = []; @@ -224,7 +224,7 @@ function forInStatement7() { function forInStatement8() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _i, c; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = []; diff --git a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js index 0d5c7753da9..e12f1e18d44 100644 --- a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js @@ -81,7 +81,7 @@ async function forOfStatement18() { function forOfStatement0() { return __awaiter(this, void 0, void 0, function () { var _i, y_1; - return __generator(function (_a) { + return __generator(this, function (_a) { for (_i = 0, y_1 = y; _i < y_1.length; _i++) { x = y_1[_i]; z; @@ -93,7 +93,7 @@ function forOfStatement0() { function forOfStatement1() { return __awaiter(this, void 0, void 0, function () { var _i, _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _i = 0; @@ -118,7 +118,7 @@ function forOfStatement1() { function forOfStatement2() { return __awaiter(this, void 0, void 0, function () { var _i, y_2; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _i = 0, y_2 = y; @@ -142,7 +142,7 @@ function forOfStatement2() { function forOfStatement3() { return __awaiter(this, void 0, void 0, function () { var _i, y_3; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _i = 0, y_3 = y; @@ -166,7 +166,7 @@ function forOfStatement3() { function forOfStatement4() { return __awaiter(this, void 0, void 0, function () { var _i, _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _i = 0; @@ -191,7 +191,7 @@ function forOfStatement4() { function forOfStatement5() { return __awaiter(this, void 0, void 0, function () { var _i, y_4; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _i = 0, y_4 = y; @@ -215,7 +215,7 @@ function forOfStatement5() { function forOfStatement6() { return __awaiter(this, void 0, void 0, function () { var _i, y_5, b; - return __generator(function (_a) { + return __generator(this, function (_a) { for (_i = 0, y_5 = y; _i < y_5.length; _i++) { b = y_5[_i]; z; @@ -227,7 +227,7 @@ function forOfStatement6() { function forOfStatement7() { return __awaiter(this, void 0, void 0, function () { var _i, _a, c; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _i = 0; @@ -252,7 +252,7 @@ function forOfStatement7() { function forOfStatement8() { return __awaiter(this, void 0, void 0, function () { var _i, y_6, d; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _i = 0, y_6 = y; @@ -276,7 +276,7 @@ function forOfStatement8() { function forOfStatement9() { return __awaiter(this, void 0, void 0, function () { var _i, _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _i = 0; @@ -301,7 +301,7 @@ function forOfStatement9() { function forOfStatement10() { return __awaiter(this, void 0, void 0, function () { var _i, y_7; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _i = 0, y_7 = y; @@ -325,7 +325,7 @@ function forOfStatement10() { function forOfStatement11() { return __awaiter(this, void 0, void 0, function () { var _i, y_8, _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0, y_8 = y; @@ -358,7 +358,7 @@ function forOfStatement11() { function forOfStatement12() { return __awaiter(this, void 0, void 0, function () { var _i, _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0; @@ -383,7 +383,7 @@ function forOfStatement12() { function forOfStatement13() { return __awaiter(this, void 0, void 0, function () { var _i, y_9, _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _i = 0, y_9 = y; @@ -407,7 +407,7 @@ function forOfStatement13() { function forOfStatement14() { return __awaiter(this, void 0, void 0, function () { var _i, _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _i = 0; @@ -432,7 +432,7 @@ function forOfStatement14() { function forOfStatement15() { return __awaiter(this, void 0, void 0, function () { var _i, y_10; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _i = 0, y_10 = y; @@ -456,7 +456,7 @@ function forOfStatement15() { function forOfStatement16() { return __awaiter(this, void 0, void 0, function () { var _i, y_11, _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0, y_11 = y; @@ -489,7 +489,7 @@ function forOfStatement16() { function forOfStatement17() { return __awaiter(this, void 0, void 0, function () { var _i, _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0; @@ -514,7 +514,7 @@ function forOfStatement17() { function forOfStatement18() { return __awaiter(this, void 0, void 0, function () { var _i, y_12, _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _i = 0, y_12 = y; diff --git a/tests/baselines/reference/es5-asyncFunctionForStatements.js b/tests/baselines/reference/es5-asyncFunctionForStatements.js index bea0d5838a4..e02d20c7864 100644 --- a/tests/baselines/reference/es5-asyncFunctionForStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForStatements.js @@ -32,7 +32,7 @@ async function forStatement6() { //// [es5-asyncFunctionForStatements.js] function forStatement0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { for (x; y; z) { a; } @@ -42,7 +42,7 @@ function forStatement0() { } function forStatement1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -63,7 +63,7 @@ function forStatement1() { } function forStatement2() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: x; @@ -84,7 +84,7 @@ function forStatement2() { } function forStatement3() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: x; @@ -105,7 +105,7 @@ function forStatement3() { } function forStatement4() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: x; @@ -128,7 +128,7 @@ function forStatement4() { function forStatement5() { return __awaiter(this, void 0, void 0, function () { var b; - return __generator(function (_a) { + return __generator(this, function (_a) { for (; y; z) { a; } @@ -139,7 +139,7 @@ function forStatement5() { function forStatement6() { return __awaiter(this, void 0, void 0, function () { var c; - return __generator(function (_a) { + return __generator(this, function (_a) { for (c = x; y; z) { a; } diff --git a/tests/baselines/reference/es5-asyncFunctionHoisting.js b/tests/baselines/reference/es5-asyncFunctionHoisting.js index 6dc05e65bf3..1ee846d0126 100644 --- a/tests/baselines/reference/es5-asyncFunctionHoisting.js +++ b/tests/baselines/reference/es5-asyncFunctionHoisting.js @@ -59,7 +59,7 @@ function hoisting() { var b0, b1 = 1; } var a0, a1, c0, c1, a, b, _i, y_1, c; - return __generator(function (_a) { + return __generator(this, function (_a) { a1 = 1; if (true) { c1 = 1; @@ -81,7 +81,7 @@ function hoistingWithAwait() { var b0, b1 = 1; } var a0, a1, c0, c1, a, b, _i, y_2, c; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: a1 = 1; diff --git a/tests/baselines/reference/es5-asyncFunctionIfStatements.js b/tests/baselines/reference/es5-asyncFunctionIfStatements.js index 9f7c71a7f3f..7ac35c995e7 100644 --- a/tests/baselines/reference/es5-asyncFunctionIfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionIfStatements.js @@ -16,7 +16,7 @@ async function ifStatement3() { //// [es5-asyncFunctionIfStatements.js] function ifStatement1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -33,7 +33,7 @@ function ifStatement1() { } function ifStatement2() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -52,7 +52,7 @@ function ifStatement2() { } function ifStatement3() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) diff --git a/tests/baselines/reference/es5-asyncFunctionNestedLoops.js b/tests/baselines/reference/es5-asyncFunctionNestedLoops.js index 3290965d6cf..28ccc288b7e 100644 --- a/tests/baselines/reference/es5-asyncFunctionNestedLoops.js +++ b/tests/baselines/reference/es5-asyncFunctionNestedLoops.js @@ -16,7 +16,7 @@ async function nestedLoops() { //// [es5-asyncFunctionNestedLoops.js] function nestedLoops() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) diff --git a/tests/baselines/reference/es5-asyncFunctionNewExpressions.js b/tests/baselines/reference/es5-asyncFunctionNewExpressions.js index b7d4514d24e..486bf0fdd7f 100644 --- a/tests/baselines/reference/es5-asyncFunctionNewExpressions.js +++ b/tests/baselines/reference/es5-asyncFunctionNewExpressions.js @@ -88,7 +88,7 @@ async function newExpression20() { //// [es5-asyncFunctionNewExpressions.js] function newExpression0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, new x(y, z)]; case 1: @@ -100,7 +100,7 @@ function newExpression0() { } function newExpression1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -113,7 +113,7 @@ function newExpression1() { function newExpression2() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = x.bind; @@ -128,7 +128,7 @@ function newExpression2() { function newExpression3() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = x.bind; @@ -143,7 +143,7 @@ function newExpression3() { } function newExpression4() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, new (x.bind.apply(x, [void 0].concat(y, [z])))()]; case 1: @@ -156,7 +156,7 @@ function newExpression4() { function newExpression5() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -169,7 +169,7 @@ function newExpression5() { function newExpression6() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d, _e, _f; - return __generator(function (_g) { + return __generator(this, function (_g) { switch (_g.label) { case 0: _b = (_a = x.bind).apply; @@ -186,7 +186,7 @@ function newExpression6() { function newExpression7() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d, _e, _f, _g; - return __generator(function (_h) { + return __generator(this, function (_h) { switch (_h.label) { case 0: _b = (_a = x.bind).apply; @@ -204,7 +204,7 @@ function newExpression7() { function newExpression8() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d; - return __generator(function (_e) { + return __generator(this, function (_e) { switch (_e.label) { case 0: _b = (_a = x.bind).apply; @@ -221,7 +221,7 @@ function newExpression8() { function newExpression9() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d, _e, _f; - return __generator(function (_g) { + return __generator(this, function (_g) { switch (_g.label) { case 0: _b = (_a = x.bind).apply; @@ -237,7 +237,7 @@ function newExpression9() { } function newExpression10() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, new x.a(y, z)]; case 1: @@ -249,7 +249,7 @@ function newExpression10() { } function newExpression11() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x.a]; case 1: @@ -261,7 +261,7 @@ function newExpression11() { } function newExpression12() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -274,7 +274,7 @@ function newExpression12() { function newExpression13() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x.a).bind; @@ -289,7 +289,7 @@ function newExpression13() { function newExpression14() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x.a).bind; @@ -304,7 +304,7 @@ function newExpression14() { } function newExpression15() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, new x[a](y, z)]; case 1: @@ -316,7 +316,7 @@ function newExpression15() { } function newExpression16() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x[a]]; case 1: @@ -328,7 +328,7 @@ function newExpression16() { } function newExpression17() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -341,7 +341,7 @@ function newExpression17() { function newExpression18() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -356,7 +356,7 @@ function newExpression18() { function newExpression19() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x[a]).bind; @@ -371,7 +371,7 @@ function newExpression19() { function newExpression20() { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c; - return __generator(function (_d) { + return __generator(this, function (_d) { switch (_d.label) { case 0: _b = (_a = x[a]).bind; diff --git a/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js b/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js index 1c5d1fcd23b..8bc90935d37 100644 --- a/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js +++ b/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js @@ -54,7 +54,7 @@ async function objectLiteral6() { function objectLiteral0() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = {}; @@ -71,7 +71,7 @@ function objectLiteral0() { function objectLiteral1() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = { @@ -89,7 +89,7 @@ function objectLiteral1() { function objectLiteral2() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = {}; @@ -106,7 +106,7 @@ function objectLiteral2() { function objectLiteral3() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _b = {}; @@ -124,7 +124,7 @@ function objectLiteral3() { function objectLiteral4() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = {}; @@ -141,7 +141,7 @@ function objectLiteral4() { function objectLiteral5() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = { @@ -159,7 +159,7 @@ function objectLiteral5() { function objectLiteral6() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _b = { diff --git a/tests/baselines/reference/es5-asyncFunctionPropertyAccess.js b/tests/baselines/reference/es5-asyncFunctionPropertyAccess.js index 47110ff11bc..436428a76c5 100644 --- a/tests/baselines/reference/es5-asyncFunctionPropertyAccess.js +++ b/tests/baselines/reference/es5-asyncFunctionPropertyAccess.js @@ -16,7 +16,7 @@ async function callExpression0() { //// [es5-asyncFunctionPropertyAccess.js] function propertyAccess0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x.a]; case 1: @@ -28,7 +28,7 @@ function propertyAccess0() { } function propertyAccess1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -40,7 +40,7 @@ function propertyAccess1() { } function callExpression0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x(y, z)]; case 1: diff --git a/tests/baselines/reference/es5-asyncFunctionReturnStatements.js b/tests/baselines/reference/es5-asyncFunctionReturnStatements.js index df279f3680d..7574da05a38 100644 --- a/tests/baselines/reference/es5-asyncFunctionReturnStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionReturnStatements.js @@ -28,22 +28,22 @@ async function returnStatement5(): Promise{ //// [es5-asyncFunctionReturnStatements.js] function returnStatement0() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); } function returnStatement1() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { return [2 /*return*/, x]; }); }); } function returnStatement2() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: return [2 /*return*/, _a.sent()]; @@ -52,8 +52,8 @@ function returnStatement2() { }); } function returnStatement3() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { { return [2 /*return*/]; } @@ -62,8 +62,8 @@ function returnStatement3() { }); } function returnStatement4() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -77,8 +77,8 @@ function returnStatement4() { }); } function returnStatement5() { - return __awaiter(this, void 0, Promise, function () { - return __generator(function (_a) { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: return [2 /*return*/, _a.sent()]; diff --git a/tests/baselines/reference/es5-asyncFunctionSwitchStatements.js b/tests/baselines/reference/es5-asyncFunctionSwitchStatements.js index 7c6da63dfe4..0af5f8e1c60 100644 --- a/tests/baselines/reference/es5-asyncFunctionSwitchStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionSwitchStatements.js @@ -70,7 +70,7 @@ async function switchStatement8() { //// [es5-asyncFunctionSwitchStatements.js] function switchStatement0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (x) { case y: a; @@ -85,7 +85,7 @@ function switchStatement0() { } function switchStatement1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -105,7 +105,7 @@ function switchStatement1() { function switchStatement2() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -129,7 +129,7 @@ function switchStatement2() { function switchStatement3() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -152,7 +152,7 @@ function switchStatement3() { function switchStatement4() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -175,7 +175,7 @@ function switchStatement4() { function switchStatement5() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -202,7 +202,7 @@ function switchStatement5() { function switchStatement6() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -230,7 +230,7 @@ function switchStatement6() { function switchStatement7() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -260,7 +260,7 @@ function switchStatement7() { function switchStatement8() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; diff --git a/tests/baselines/reference/es5-asyncFunctionTryStatements.js b/tests/baselines/reference/es5-asyncFunctionTryStatements.js index 54371c5842f..c9c5507afa7 100644 --- a/tests/baselines/reference/es5-asyncFunctionTryStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionTryStatements.js @@ -126,7 +126,7 @@ async function tryCatchFinally3() { function tryCatch0() { return __awaiter(this, void 0, void 0, function () { var x, y; - return __generator(function (_a) { + return __generator(this, function (_a) { try { x; } @@ -140,7 +140,7 @@ function tryCatch0() { function tryCatch1() { return __awaiter(this, void 0, void 0, function () { var x, y, e_1; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); @@ -160,7 +160,7 @@ function tryCatch1() { function tryCatch2() { return __awaiter(this, void 0, void 0, function () { var x, y, e_2; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 1, , 3]); @@ -178,9 +178,9 @@ function tryCatch2() { }); } function tryCatch3() { - return __awaiter(this, void 0, Promise, function () { + return __awaiter(this, void 0, void 0, function () { var x, y, e_3; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); @@ -199,7 +199,7 @@ function tryCatch3() { function tryFinally0() { return __awaiter(this, void 0, void 0, function () { var x, y; - return __generator(function (_a) { + return __generator(this, function (_a) { try { x; } @@ -213,7 +213,7 @@ function tryFinally0() { function tryFinally1() { return __awaiter(this, void 0, void 0, function () { var x, y; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, , 2, 3]); @@ -232,7 +232,7 @@ function tryFinally1() { function tryFinally2() { return __awaiter(this, void 0, void 0, function () { var x, y; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, , 1, 3]); @@ -250,7 +250,7 @@ function tryFinally2() { function tryCatchFinally0() { return __awaiter(this, void 0, void 0, function () { var x, y, z; - return __generator(function (_a) { + return __generator(this, function (_a) { try { x; } @@ -267,7 +267,7 @@ function tryCatchFinally0() { function tryCatchFinally1() { return __awaiter(this, void 0, void 0, function () { var x, y, z, e_4; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, 3, 4]); @@ -290,7 +290,7 @@ function tryCatchFinally1() { function tryCatchFinally2() { return __awaiter(this, void 0, void 0, function () { var x, y, z, e_5; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 1, 3, 4]); @@ -313,7 +313,7 @@ function tryCatchFinally2() { function tryCatchFinally3() { return __awaiter(this, void 0, void 0, function () { var x, y, z, e_6; - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 1, 2, 4]); diff --git a/tests/baselines/reference/es5-asyncFunctionWhileStatements.js b/tests/baselines/reference/es5-asyncFunctionWhileStatements.js index 53ca2a2da37..c85aabb01e3 100644 --- a/tests/baselines/reference/es5-asyncFunctionWhileStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionWhileStatements.js @@ -80,7 +80,7 @@ async function whileStatement18() { //// [es5-asyncFunctionWhileStatements.js] function whileStatement0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { while (x) { y; } @@ -90,7 +90,7 @@ function whileStatement0() { } function whileStatement1() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -105,7 +105,7 @@ function whileStatement1() { } function whileStatement2() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -121,7 +121,7 @@ function whileStatement2() { } function whileStatement3() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { while (x) { continue; } @@ -131,7 +131,7 @@ function whileStatement3() { } function whileStatement4() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -145,7 +145,7 @@ function whileStatement4() { } function whileStatement5() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -161,7 +161,7 @@ function whileStatement5() { } function whileStatement6() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -179,7 +179,7 @@ function whileStatement6() { } function whileStatement7() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { A: while (x) { continue A; } @@ -189,7 +189,7 @@ function whileStatement7() { } function whileStatement8() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -203,7 +203,7 @@ function whileStatement8() { } function whileStatement9() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -219,7 +219,7 @@ function whileStatement9() { } function whileStatement10() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -237,7 +237,7 @@ function whileStatement10() { } function whileStatement11() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { while (x) { break; } @@ -247,7 +247,7 @@ function whileStatement11() { } function whileStatement12() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -261,7 +261,7 @@ function whileStatement12() { } function whileStatement13() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -277,7 +277,7 @@ function whileStatement13() { } function whileStatement14() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -295,7 +295,7 @@ function whileStatement14() { } function whileStatement15() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { E: while (x) { break E; } @@ -305,7 +305,7 @@ function whileStatement15() { } function whileStatement16() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -319,7 +319,7 @@ function whileStatement16() { } function whileStatement17() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) @@ -335,7 +335,7 @@ function whileStatement17() { } function whileStatement18() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { switch (_a.label) { case 0: if (!x) diff --git a/tests/baselines/reference/es5-asyncFunctionWithStatements.js b/tests/baselines/reference/es5-asyncFunctionWithStatements.js index 20bedc25da9..25ed4df5c11 100644 --- a/tests/baselines/reference/es5-asyncFunctionWithStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionWithStatements.js @@ -34,7 +34,7 @@ async function withStatement3() { //// [es5-asyncFunctionWithStatements.js] function withStatement0() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { with (x) { y; } @@ -45,7 +45,7 @@ function withStatement0() { function withStatement1() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, x]; case 1: @@ -64,7 +64,7 @@ function withStatement1() { function withStatement2() { return __awaiter(this, void 0, void 0, function () { var _a; - return __generator(function (_b) { + return __generator(this, function (_b) { switch (_b.label) { case 0: _a = x; @@ -87,7 +87,7 @@ function withStatement2() { function withStatement3() { return __awaiter(this, void 0, void 0, function () { var _a, _b; - return __generator(function (_c) { + return __generator(this, function (_c) { switch (_c.label) { case 0: _a = x; diff --git a/tests/baselines/reference/es5-importHelpersAsyncFunctions.js b/tests/baselines/reference/es5-importHelpersAsyncFunctions.js index b90e2248c2c..0fcd8897018 100644 --- a/tests/baselines/reference/es5-importHelpersAsyncFunctions.js +++ b/tests/baselines/reference/es5-importHelpersAsyncFunctions.js @@ -22,7 +22,7 @@ export declare function __generator(body: Function): any; var tslib_1 = require("tslib"); function foo() { return tslib_1.__awaiter(this, void 0, void 0, function () { - return tslib_1.__generator(function (_a) { + return tslib_1.__generator(this, function (_a) { return [2 /*return*/]; }); }); @@ -37,7 +37,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments)).next()); }); }; -var __generator = (this && this.__generator) || function (body) { +var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (sent[0] === 1) throw sent[1]; return sent[1]; }, trys: [], stack: [] }, sent, f; function step(op) { if (f) throw new TypeError("Generator is already executing."); @@ -62,7 +62,7 @@ var __generator = (this && this.__generator) || function (body) { _.trys.pop(); continue; } - op = body(_); + op = body.call(thisArg, _); } catch (e) { op = [6, e]; } finally { f = 0, sent = void 0; } @@ -76,7 +76,7 @@ var __generator = (this && this.__generator) || function (body) { }; function foo() { return __awaiter(this, void 0, void 0, function () { - return __generator(function (_a) { + return __generator(this, function (_a) { return [2 /*return*/]; }); }); diff --git a/tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts b/tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts new file mode 100644 index 00000000000..5ab13f88b36 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncAliasReturnType_es5.ts @@ -0,0 +1,7 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +type PromiseAlias = Promise; + +async function f(): PromiseAlias { +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts b/tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts new file mode 100644 index 00000000000..4ee04b2b3e9 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncAwaitIsolatedModules_es5.ts @@ -0,0 +1,42 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @isolatedModules: true +import { MyPromise } from "missing"; + +declare var p: Promise; +declare var mp: MyPromise; + +async function f0() { } +async function f1(): Promise { } +async function f3(): MyPromise { } + +let f4 = async function() { } +let f5 = async function(): Promise { } +let f6 = async function(): MyPromise { } + +let f7 = async () => { }; +let f8 = async (): Promise => { }; +let f9 = async (): MyPromise => { }; +let f10 = async () => p; +let f11 = async () => mp; +let f12 = async (): Promise => mp; +let f13 = async (): MyPromise => p; + +let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } +}; + +class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } +} + +module M { + export async function f1() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncAwait_es5.ts b/tests/cases/conformance/async/es5/asyncAwait_es5.ts new file mode 100644 index 00000000000..88cda3201dc --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncAwait_es5.ts @@ -0,0 +1,41 @@ +// @target: ES5 +// @lib: es5,es2015.promise +type MyPromise = Promise; +declare var MyPromise: typeof Promise; +declare var p: Promise; +declare var mp: MyPromise; + +async function f0() { } +async function f1(): Promise { } +async function f3(): MyPromise { } + +let f4 = async function() { } +let f5 = async function(): Promise { } +let f6 = async function(): MyPromise { } + +let f7 = async () => { }; +let f8 = async (): Promise => { }; +let f9 = async (): MyPromise => { }; +let f10 = async () => p; +let f11 = async () => mp; +let f12 = async (): Promise => mp; +let f13 = async (): MyPromise => p; + +let o = { + async m1() { }, + async m2(): Promise { }, + async m3(): MyPromise { } +}; + +class C { + async m1() { } + async m2(): Promise { } + async m3(): MyPromise { } + static async m4() { } + static async m5(): Promise { } + static async m6(): MyPromise { } +} + +module M { + export async function f1() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncClass_es5.ts b/tests/cases/conformance/async/es5/asyncClass_es5.ts new file mode 100644 index 00000000000..70f32702bd0 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncClass_es5.ts @@ -0,0 +1,5 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +async class C { +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncConstructor_es5.ts b/tests/cases/conformance/async/es5/asyncConstructor_es5.ts new file mode 100644 index 00000000000..57cb07561b9 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncConstructor_es5.ts @@ -0,0 +1,7 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +class C { + async constructor() { + } +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncDeclare_es5.ts b/tests/cases/conformance/async/es5/asyncDeclare_es5.ts new file mode 100644 index 00000000000..aad035337d3 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncDeclare_es5.ts @@ -0,0 +1,4 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +declare async function foo(): Promise; \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncEnum_es5.ts b/tests/cases/conformance/async/es5/asyncEnum_es5.ts new file mode 100644 index 00000000000..7f0060bf04f --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncEnum_es5.ts @@ -0,0 +1,6 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +async enum E { + Value +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncGetter_es5.ts b/tests/cases/conformance/async/es5/asyncGetter_es5.ts new file mode 100644 index 00000000000..8c12c4f3462 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncGetter_es5.ts @@ -0,0 +1,7 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +class C { + async get foo() { + } +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts b/tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts new file mode 100644 index 00000000000..9e8494b3c2f --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncImportedPromise_es5.ts @@ -0,0 +1,11 @@ +// @target: es5 +// @lib: es5,es2015.promise +// @module: commonjs +// @filename: task.ts +export class Task extends Promise { } + +// @filename: test.ts +import { Task } from "./task"; +class Test { + async example(): Task { return; } +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncInterface_es5.ts b/tests/cases/conformance/async/es5/asyncInterface_es5.ts new file mode 100644 index 00000000000..7ac70f40a69 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncInterface_es5.ts @@ -0,0 +1,5 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +async interface I { +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts b/tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts new file mode 100644 index 00000000000..496d8d1c802 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncMethodWithSuper_es5.ts @@ -0,0 +1,53 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +class A { + x() { + } +} + +class B extends A { + // async method with only call/get on 'super' does not require a binding + async simple() { + // call with property access + super.x(); + + // call with element access + super["x"](); + + // property access (read) + const a = super.x; + + // element access (read) + const b = super["x"]; + } + + // async method with assignment/destructuring on 'super' requires a binding + async advanced() { + const f = () => {}; + + // call with property access + super.x(); + + // call with element access + super["x"](); + + // property access (read) + const a = super.x; + + // element access (read) + const b = super["x"]; + + // property access (assign) + super.x = f; + + // element access (assign) + super["x"] = f; + + // destructuring assign with property access + ({ f: super.x } = { f }); + + // destructuring assign with element access + ({ f: super["x"] } = { f }); + } +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncModule_es5.ts b/tests/cases/conformance/async/es5/asyncModule_es5.ts new file mode 100644 index 00000000000..55df9f89dc3 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncModule_es5.ts @@ -0,0 +1,5 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +async module M { +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncMultiFile_es5.ts b/tests/cases/conformance/async/es5/asyncMultiFile_es5.ts new file mode 100644 index 00000000000..66d4f4e673f --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncMultiFile_es5.ts @@ -0,0 +1,6 @@ +// @target: es5 +// @lib: es5,es2015.promise +// @filename: a.ts +async function f() {} +// @filename: b.ts +function g() { } \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts b/tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts new file mode 100644 index 00000000000..34fc1b13389 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncQualifiedReturnType_es5.ts @@ -0,0 +1,10 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +namespace X { + export class MyPromise extends Promise { + } +} + +async function f(): X.MyPromise { +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncSetter_es5.ts b/tests/cases/conformance/async/es5/asyncSetter_es5.ts new file mode 100644 index 00000000000..419922b0806 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncSetter_es5.ts @@ -0,0 +1,7 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +class C { + async set foo(value) { + } +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/asyncUseStrict_es5.ts b/tests/cases/conformance/async/es5/asyncUseStrict_es5.ts new file mode 100644 index 00000000000..cc20d594de5 --- /dev/null +++ b/tests/cases/conformance/async/es5/asyncUseStrict_es5.ts @@ -0,0 +1,9 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +declare var a: boolean; +declare var p: Promise; +async function func(): Promise { + "use strict"; + var b = await p || a; +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/awaitClassExpression_es5.ts b/tests/cases/conformance/async/es5/awaitClassExpression_es5.ts new file mode 100644 index 00000000000..27eafeb1af5 --- /dev/null +++ b/tests/cases/conformance/async/es5/awaitClassExpression_es5.ts @@ -0,0 +1,10 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +declare class C { } +declare var p: Promise; + +async function func(): Promise { + class D extends (await p) { + } +} \ No newline at end of file diff --git a/tests/cases/conformance/async/es5/awaitUnion_es5.ts b/tests/cases/conformance/async/es5/awaitUnion_es5.ts new file mode 100644 index 00000000000..44ceb1374d6 --- /dev/null +++ b/tests/cases/conformance/async/es5/awaitUnion_es5.ts @@ -0,0 +1,15 @@ +// @target: ES5 +// @lib: es5,es2015.promise +// @noEmitHelpers: true +declare let a: number | string; +declare let b: PromiseLike | PromiseLike; +declare let c: PromiseLike; +declare let d: number | PromiseLike; +declare let e: number | PromiseLike; +async function f() { + let await_a = await a; + let await_b = await b; + let await_c = await c; + let await_d = await d; + let await_e = await e; +} \ No newline at end of file