Added emit for async functions in ES6
This commit is contained in:
parent
d19a200750
commit
e82e8419c2
|
@ -102,7 +102,7 @@ module ts {
|
|||
let globalArraySymbol: Symbol;
|
||||
let globalESSymbolConstructorSymbol: Symbol;
|
||||
|
||||
let getGlobalPromiseSymbol: () => Symbol;
|
||||
let getGlobalPromiseConstructorSymbol: () => Symbol;
|
||||
|
||||
let globalObjectType: ObjectType;
|
||||
let globalFunctionType: ObjectType;
|
||||
|
@ -139,7 +139,6 @@ module ts {
|
|||
let symbolLinks: SymbolLinks[] = [];
|
||||
let nodeLinks: NodeLinks[] = [];
|
||||
let potentialThisCollisions: Node[] = [];
|
||||
var potentialArgumentsCollisions: Node[] = [];
|
||||
|
||||
let diagnostics = createDiagnosticCollection();
|
||||
|
||||
|
@ -5420,11 +5419,13 @@ module ts {
|
|||
// can explicitly bound arguments objects
|
||||
let container = getContainingFunction(node);
|
||||
if (symbol === argumentsSymbol) {
|
||||
if (container.kind === SyntaxKind.ArrowFunction && languageVersion < ScriptTarget.ES6) {
|
||||
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
||||
}
|
||||
else if (node.parserContextFlags & ParserContextFlags.Await) {
|
||||
captureLexicalArguments(node, container);
|
||||
if (container.kind === SyntaxKind.ArrowFunction) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
||||
}
|
||||
else if (node.parserContextFlags & ParserContextFlags.Await) {
|
||||
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5434,7 +5435,6 @@ module ts {
|
|||
|
||||
checkCollisionWithCapturedSuperVariable(node, node);
|
||||
checkCollisionWithCapturedThisVariable(node, node);
|
||||
checkCollisionWithCapturedArgumentsVariable(node, node);
|
||||
checkBlockScopedBindingCapturedInLoop(node, symbol);
|
||||
|
||||
return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node);
|
||||
|
@ -5516,10 +5516,9 @@ module ts {
|
|||
// When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code
|
||||
needToCaptureLexicalThis = (languageVersion < ScriptTarget.ES6);
|
||||
}
|
||||
|
||||
if (node.parserContextFlags & ParserContextFlags.Await) {
|
||||
else if (node.parserContextFlags & ParserContextFlags.Await) {
|
||||
// if 'this' is part of an async function, we will need to capture 'this'
|
||||
needToCaptureLexicalThis = true;
|
||||
needToCaptureLexicalThis = (languageVersion < ScriptTarget.ES6);
|
||||
}
|
||||
|
||||
switch (container.kind) {
|
||||
|
@ -5561,14 +5560,6 @@ module ts {
|
|||
return anyType;
|
||||
}
|
||||
|
||||
function captureLexicalArguments(node: Node, container: Node): void {
|
||||
if (node.parent.kind !== SyntaxKind.Parameter) {
|
||||
getNodeLinks(node).flags |= NodeCheckFlags.LexicalArguments;
|
||||
}
|
||||
|
||||
getNodeLinks(container).flags |= NodeCheckFlags.CaptureArguments;
|
||||
}
|
||||
|
||||
function isInConstructorArgumentInitializer(node: Node, constructorDecl: Node): boolean {
|
||||
for (let n = node; n && n !== constructorDecl; n = n.parent) {
|
||||
if (n.kind === SyntaxKind.Parameter) {
|
||||
|
@ -7303,7 +7294,7 @@ module ts {
|
|||
let widenedType = getWidenedType(type);
|
||||
return isAsync
|
||||
? createPromiseType(widenedType, func)
|
||||
: type;
|
||||
: widenedType;
|
||||
}
|
||||
|
||||
/// Returns a set of types relating to every return expression relating to a function block.
|
||||
|
@ -7421,7 +7412,6 @@ module ts {
|
|||
if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) {
|
||||
checkCollisionWithCapturedSuperVariable(node, (<FunctionExpression>node).name);
|
||||
checkCollisionWithCapturedThisVariable(node, (<FunctionExpression>node).name);
|
||||
checkCollisionWithCapturedArgumentsVariable(node, (<FunctionExpression>node).name);
|
||||
}
|
||||
|
||||
return type;
|
||||
|
@ -7574,13 +7564,7 @@ module ts {
|
|||
function checkAwaitExpression(node: AwaitExpression): Type {
|
||||
// Grammar checking
|
||||
if (!(node.parserContextFlags & ParserContextFlags.Await)) {
|
||||
var parameter = getContainingParameter(node);
|
||||
if (parameter && parameter.parserContextFlags & ParserContextFlags.Await) {
|
||||
grammarErrorAfterFirstToken(node, Diagnostics._0_expression_is_not_allowed_in_an_initializer, "await");
|
||||
}
|
||||
else {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.await_expression_must_be_contained_within_an_async_function);
|
||||
}
|
||||
grammarErrorOnFirstToken(node, Diagnostics.await_expression_must_be_contained_within_an_async_function);
|
||||
}
|
||||
|
||||
var operandType = checkExpression(node.expression);
|
||||
|
@ -7994,13 +7978,7 @@ module ts {
|
|||
function checkYieldExpression(node: YieldExpression): void {
|
||||
// Grammar checking
|
||||
if (!(node.parserContextFlags & ParserContextFlags.Yield)) {
|
||||
let parameter = getContainingParameter(node);
|
||||
if (parameter && (parameter.parserContextFlags & ParserContextFlags.GeneratorParameter)) {
|
||||
grammarErrorAfterFirstToken(node, Diagnostics._0_expression_is_not_allowed_in_an_initializer, "yield");
|
||||
}
|
||||
else {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration);
|
||||
}
|
||||
grammarErrorOnFirstToken(node, Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration);
|
||||
}
|
||||
else {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.yield_expressions_are_not_currently_supported);
|
||||
|
@ -8907,23 +8885,25 @@ module ts {
|
|||
// the "promised type" of a type is the type of the "value" argument of the "onfulfilled" callback.
|
||||
let globalPromiseLikeType = getInstantiatedGlobalPromiseLikeType();
|
||||
if (globalPromiseLikeType !== emptyObjectType && isTypeAssignableTo(type, globalPromiseLikeType)) {
|
||||
let awaitedTypes: Type[] = [];
|
||||
let thenProp = getPropertyOfType(type, "then");
|
||||
let thenType = getTypeOfSymbol(thenProp);
|
||||
let thenSignatures = getSignaturesOfType(thenType, SignatureKind.Call);
|
||||
for (let thenSignature of thenSignatures) {
|
||||
thenSignature = getErasedSignature(thenSignature);
|
||||
let onfulfilledParameterType = getTypeAtPosition(thenSignature, 0);
|
||||
let onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, SignatureKind.Call);
|
||||
for (let onfulfilledParameterSignature of onfulfilledParameterSignatures) {
|
||||
let valueParameterType = getTypeAtPosition(onfulfilledParameterSignature, 0);
|
||||
if (valueParameterType !== type) {
|
||||
awaitedTypes.push(valueParameterType);
|
||||
if (thenProp) {
|
||||
let awaitedTypes: Type[] = [];
|
||||
let thenType = getTypeOfSymbol(thenProp);
|
||||
let thenSignatures = getSignaturesOfType(thenType, SignatureKind.Call);
|
||||
for (let thenSignature of thenSignatures) {
|
||||
thenSignature = getErasedSignature(thenSignature);
|
||||
let onfulfilledParameterType = getTypeAtPosition(thenSignature, 0);
|
||||
let onfulfilledParameterSignatures = getSignaturesOfType(onfulfilledParameterType, SignatureKind.Call);
|
||||
for (let onfulfilledParameterSignature of onfulfilledParameterSignatures) {
|
||||
let valueParameterType = getTypeAtPosition(onfulfilledParameterSignature, 0);
|
||||
if (valueParameterType !== type) {
|
||||
awaitedTypes.push(valueParameterType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getUnionType(awaitedTypes);
|
||||
|
||||
return getUnionType(awaitedTypes);
|
||||
}
|
||||
}
|
||||
|
||||
return emptyObjectType;
|
||||
|
@ -9142,7 +9122,6 @@ module ts {
|
|||
|
||||
checkCollisionWithCapturedSuperVariable(node, node.name);
|
||||
checkCollisionWithCapturedThisVariable(node, node.name);
|
||||
checkCollisionWithCapturedArgumentsVariable(node, node.name);
|
||||
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
|
||||
}
|
||||
}
|
||||
|
@ -9262,12 +9241,6 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function checkCollisionWithCapturedArgumentsVariable(node: Node, name: Identifier): void {
|
||||
if (needCollisionCheckForIdentifier(node, name, "_arguments")) {
|
||||
potentialArgumentsCollisions.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
// this function will run after checking the source file so 'CaptureThis' is correct for all nodes
|
||||
function checkIfThisIsCapturedInEnclosingScope(node: Node): void {
|
||||
let current = node;
|
||||
|
@ -9286,25 +9259,6 @@ module ts {
|
|||
}
|
||||
}
|
||||
|
||||
function checkIfArgumentsIsCapturedInEnclosingScope(node: Node): void {
|
||||
let current = node;
|
||||
while (current) {
|
||||
if (getNodeCheckFlags(current) & NodeCheckFlags.CaptureArguments) {
|
||||
let isDeclaration = node.kind !== SyntaxKind.Identifier;
|
||||
if (isDeclaration) {
|
||||
error((<Declaration>node).name, Diagnostics.Duplicate_identifier_arguments_Compiler_uses_variable_declaration_arguments_to_capture_arguments_reference);
|
||||
}
|
||||
else {
|
||||
error(node, Diagnostics.Expression_resolves_to_variable_declaration_arguments_that_compiler_uses_to_capture_arguments_reference);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
current = current.parent;
|
||||
}
|
||||
}
|
||||
|
||||
function checkCollisionWithCapturedSuperVariable(node: Node, name: Identifier) {
|
||||
if (!needCollisionCheckForIdentifier(node, name, "_super")) {
|
||||
return;
|
||||
|
@ -9421,15 +9375,17 @@ module ts {
|
|||
}
|
||||
|
||||
function getPromiseConstructor(node: SignatureDeclaration): EntityName {
|
||||
if (node.type && node.type.kind === SyntaxKind.TypeReference) {
|
||||
return (<TypeReferenceNode>node.type).typeName;
|
||||
if (isAsyncFunctionLike(node)) {
|
||||
let links = getNodeLinks(node);
|
||||
if (!links.promiseConstructor) {
|
||||
if (node.type && node.type.kind === SyntaxKind.TypeReference) {
|
||||
links.promiseConstructor = (<TypeReferenceNode>node.type).typeName;
|
||||
}
|
||||
}
|
||||
|
||||
return links.promiseConstructor;
|
||||
}
|
||||
|
||||
let globalPromiseSymbol = getGlobalPromiseSymbol();
|
||||
if (globalPromiseSymbol && globalPromiseSymbol === resolveName(node, "Promise", SymbolFlags.Value, undefined, undefined)) {
|
||||
return <Identifier>globalPromiseSymbol.valueDeclaration.name;
|
||||
}
|
||||
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -9550,14 +9506,8 @@ module ts {
|
|||
}
|
||||
checkCollisionWithCapturedSuperVariable(node, <Identifier>node.name);
|
||||
checkCollisionWithCapturedThisVariable(node, <Identifier>node.name);
|
||||
checkCollisionWithCapturedArgumentsVariable(node, <Identifier>node.name);
|
||||
checkCollisionWithRequireExportsInGeneratedCode(node, <Identifier>node.name);
|
||||
}
|
||||
|
||||
if (symbol === argumentsSymbol && (node.parserContextFlags & ParserContextFlags.Await)) {
|
||||
let container = getContainingFunction(node);
|
||||
captureLexicalArguments(node.name, container);
|
||||
}
|
||||
}
|
||||
|
||||
function checkVariableDeclaration(node: VariableDeclaration) {
|
||||
|
@ -11258,7 +11208,6 @@ module ts {
|
|||
emitDecorate = false;
|
||||
emitParam = false;
|
||||
potentialThisCollisions.length = 0;
|
||||
potentialArgumentsCollisions.length = 0;
|
||||
|
||||
forEach(node.statements, checkSourceElement);
|
||||
checkFunctionExpressionBodies(node);
|
||||
|
@ -11272,11 +11221,6 @@ module ts {
|
|||
potentialThisCollisions.length = 0;
|
||||
}
|
||||
|
||||
if (potentialArgumentsCollisions.length) {
|
||||
forEach(potentialArgumentsCollisions, checkIfArgumentsIsCapturedInEnclosingScope);
|
||||
potentialArgumentsCollisions.length = 0;
|
||||
}
|
||||
|
||||
if (emitExtends) {
|
||||
links.flags |= NodeCheckFlags.EmitExtends;
|
||||
}
|
||||
|
@ -12279,6 +12223,7 @@ module ts {
|
|||
serializeTypeOfNode,
|
||||
serializeParameterTypesOfNode,
|
||||
serializeReturnTypeOfNode,
|
||||
getPromiseConstructor,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -12313,10 +12258,10 @@ module ts {
|
|||
getGlobalPropertyDecoratorType = memoize(() => getGlobalType("PropertyDecorator"));
|
||||
getGlobalMethodDecoratorType = memoize(() => getGlobalType("MethodDecorator"));
|
||||
getGlobalParameterDecoratorType = memoize(() => getGlobalType("ParameterDecorator"));
|
||||
getGlobalPromiseSymbol = memoize(() => getGlobalTypeSymbol("Promise"));
|
||||
getGlobalPromiseType = memoize(() => getTypeOfGlobalSymbol(getGlobalPromiseSymbol(), /*arity*/ 1));
|
||||
getGlobalPromiseType = memoize(() => getGlobalType("Promise", /*arity*/ 1));
|
||||
getGlobalPromiseLikeType = memoize(() => getGlobalType("PromiseLike", /*arity*/ 1));
|
||||
getInstantiatedGlobalPromiseLikeType = memoize(createInstantiatedPromiseLikeType);
|
||||
getGlobalPromiseConstructorSymbol = memoize(() => getGlobalValueSymbol("Promise"));
|
||||
getGlobalPromiseConstructorLikeType = memoize(() => getGlobalType("PromiseConstructorLike"));
|
||||
getGlobalThenableType = memoize(createThenableType);
|
||||
|
||||
|
|
|
@ -383,8 +383,7 @@ module ts {
|
|||
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
|
||||
Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." },
|
||||
Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." },
|
||||
Duplicate_identifier_arguments_Compiler_uses_variable_declaration_arguments_to_capture_arguments_reference: { code: 2522, category: DiagnosticCategory.Error, key: "Duplicate identifier '_arguments'. Compiler uses variable declaration '_arguments' to capture 'arguments' reference." },
|
||||
Expression_resolves_to_variable_declaration_arguments_that_compiler_uses_to_capture_arguments_reference: { code: 2523, category: DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_arguments' that compiler uses to capture 'arguments' reference." },
|
||||
The_arguments_object_cannot_be_referenced_in_an_async_arrow_function_Consider_using_a_standard_async_function_expression: { code: 2522, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an async arrow function Consider using a standard async function expression." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
|
|
|
@ -1522,14 +1522,10 @@
|
|||
"category": "Error",
|
||||
"code": 2521
|
||||
},
|
||||
"Duplicate identifier '_arguments'. Compiler uses variable declaration '_arguments' to capture 'arguments' reference.": {
|
||||
"The 'arguments' object cannot be referenced in an async arrow function Consider using a standard async function expression.": {
|
||||
"category": "Error",
|
||||
"code": 2522
|
||||
},
|
||||
"Expression resolves to variable declaration '_arguments' that compiler uses to capture 'arguments' reference.": {
|
||||
"category": "Error",
|
||||
"code": 2523
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
|
|
@ -48,6 +48,21 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};`;
|
||||
|
||||
const awaiterHelper = `
|
||||
var __awaiter = (this && this.__awaiter) || function (generator, ctor) {
|
||||
function resolve(value) { return step(generator.next(value)); }
|
||||
function reject(reason) { return step(generator["throw"](reason)); }
|
||||
function step(result) {
|
||||
while (true) {
|
||||
var done = result.done, value = result.value, then;
|
||||
if (done) return value;
|
||||
if (value && typeof (then = value.then) === "function") return then.call(value, resolve, reject);
|
||||
result = generator.next(value);
|
||||
}
|
||||
}
|
||||
return new (ctor || Promise)(function (resolver) { resolver(resolve(undefined)); });
|
||||
}`;
|
||||
|
||||
let compilerOptions = host.getCompilerOptions();
|
||||
let languageVersion = compilerOptions.target || ScriptTarget.ES3;
|
||||
let sourceMapDataList: SourceMapData[] = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined;
|
||||
|
@ -131,6 +146,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
let extendsEmitted = false;
|
||||
let decorateEmitted = false;
|
||||
let paramEmitted = false;
|
||||
let awaiterEmitted = false;
|
||||
let tempFlags = 0;
|
||||
let tempVariables: Identifier[];
|
||||
let tempParameters: Identifier[];
|
||||
|
@ -1350,6 +1366,31 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
emit(node.expression);
|
||||
}
|
||||
}
|
||||
|
||||
function emitAwaitExpression(node: AwaitExpression) {
|
||||
let needsParenthesis = needsParenthesisForAwaitExpressionAsYield(node);
|
||||
if (needsParenthesis) {
|
||||
write("(");
|
||||
}
|
||||
write(tokenToString(SyntaxKind.YieldKeyword));
|
||||
write(" ");
|
||||
emit(node.expression);
|
||||
if (needsParenthesis) {
|
||||
write(")");
|
||||
}
|
||||
}
|
||||
|
||||
function needsParenthesisForAwaitExpressionAsYield(node: AwaitExpression) {
|
||||
for (let current: Node = node; isExpression(current.parent); current = current.parent) {
|
||||
if (current.parent.kind === SyntaxKind.BinaryExpression) {
|
||||
if ((<BinaryExpression>current.parent).left === current) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function needsParenthesisForPropertyAccessOrInvocation(node: Expression) {
|
||||
switch (node.kind) {
|
||||
|
@ -3280,9 +3321,71 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
emit(node.parameters[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
emitSignatureParameters(node);
|
||||
}
|
||||
|
||||
function emitAsyncSignatureAndBodyForES6(node: FunctionLikeDeclaration) {
|
||||
let promiseConstructor = resolver.getPromiseConstructor(node);
|
||||
let resolve = makeUniqueName("resolve");
|
||||
let isArrowFunction = node.kind === SyntaxKind.ArrowFunction;
|
||||
let args: string;
|
||||
if (isArrowFunction) {
|
||||
if (node.parameters.length) {
|
||||
args = makeUniqueName("arguments");
|
||||
write(`(...${args}) => `);
|
||||
}
|
||||
else {
|
||||
write("() => ");
|
||||
}
|
||||
}
|
||||
else {
|
||||
args = "arguments";
|
||||
write("() {");
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
write("return ");
|
||||
}
|
||||
|
||||
write("__awaiter(function *");
|
||||
|
||||
emitSignatureParameters(node);
|
||||
emitFunctionBody(node);
|
||||
write(".apply(this");
|
||||
if (args) {
|
||||
write(`, ${args}`);
|
||||
}
|
||||
write(")");
|
||||
if (promiseConstructor) {
|
||||
write(", ");
|
||||
emit(promiseConstructor);
|
||||
}
|
||||
write(")");
|
||||
|
||||
if (!isArrowFunction) {
|
||||
write(";");
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
write("}");
|
||||
}
|
||||
}
|
||||
|
||||
function emitFunctionBody(node: FunctionLikeDeclaration) {
|
||||
if (!node.body) {
|
||||
// There can be no body when there are parse errors. Just emit an empty block
|
||||
// in that case.
|
||||
write(" { }");
|
||||
}
|
||||
else {
|
||||
if (node.body.kind === SyntaxKind.Block) {
|
||||
emitBlockFunctionBody(node, <Block>node.body);
|
||||
}
|
||||
else {
|
||||
emitExpressionFunctionBody(node, <Expression>node.body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitSignatureAndBody(node: FunctionLikeDeclaration) {
|
||||
let saveTempFlags = tempFlags;
|
||||
let saveTempVariables = tempVariables;
|
||||
|
@ -3291,27 +3394,23 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
tempVariables = undefined;
|
||||
tempParameters = undefined;
|
||||
|
||||
// When targeting ES6, emit arrow function natively in ES6
|
||||
if (shouldEmitAsArrowFunction(node)) {
|
||||
emitSignatureParametersForArrow(node);
|
||||
write(" =>");
|
||||
let isAsync = isAsyncFunctionLike(node);
|
||||
if (isAsync && languageVersion === ScriptTarget.ES6) {
|
||||
emitAsyncSignatureAndBodyForES6(node);
|
||||
}
|
||||
else {
|
||||
emitSignatureParameters(node);
|
||||
// When targeting ES6, emit arrow function natively in ES6
|
||||
if (shouldEmitAsArrowFunction(node)) {
|
||||
emitSignatureParametersForArrow(node);
|
||||
write(" =>");
|
||||
}
|
||||
else {
|
||||
emitSignatureParameters(node);
|
||||
}
|
||||
|
||||
emitFunctionBody(node);
|
||||
}
|
||||
|
||||
if (!node.body) {
|
||||
// There can be no body when there are parse errors. Just emit an empty block
|
||||
// in that case.
|
||||
write(" { }");
|
||||
}
|
||||
else if (node.body.kind === SyntaxKind.Block) {
|
||||
emitBlockFunctionBody(node, <Block>node.body);
|
||||
}
|
||||
else {
|
||||
emitExpressionFunctionBody(node, <Expression>node.body);
|
||||
}
|
||||
|
||||
|
||||
if (!isES6ExportedDeclaration(node)) {
|
||||
emitExportMemberAssignment(node);
|
||||
}
|
||||
|
@ -3329,7 +3428,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
}
|
||||
|
||||
function emitExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
if (languageVersion < ScriptTarget.ES6 || node.flags & NodeFlags.Async) {
|
||||
emitDownLevelExpressionFunctionBody(node, body);
|
||||
return;
|
||||
}
|
||||
|
@ -5636,6 +5735,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
writeLines(paramHelper);
|
||||
paramEmitted = true;
|
||||
}
|
||||
|
||||
if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitAwaiter) {
|
||||
writeLines(awaiterHelper);
|
||||
awaiterEmitted = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isExternalModule(node) || compilerOptions.separateCompilation) {
|
||||
|
@ -5806,6 +5910,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|||
return emitTypeOfExpression(<TypeOfExpression>node);
|
||||
case SyntaxKind.VoidExpression:
|
||||
return emitVoidExpression(<VoidExpression>node);
|
||||
case SyntaxKind.AwaitExpression:
|
||||
return emitAwaitExpression(<AwaitExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression:
|
||||
return emitPrefixUnaryExpression(<PrefixUnaryExpression>node);
|
||||
case SyntaxKind.PostfixUnaryExpression:
|
||||
|
|
|
@ -568,11 +568,11 @@ module ts {
|
|||
}
|
||||
|
||||
function doOutsideOfContext<T>(context: ParserContextFlags, func: () => T): T {
|
||||
let currentContextFlags = contextFlags & context;
|
||||
if (currentContextFlags) {
|
||||
setContextFlag(false, currentContextFlags);
|
||||
let setContextFlags = context & contextFlags;
|
||||
if (setContextFlags) {
|
||||
setContextFlag(false, setContextFlags);
|
||||
let result = func();
|
||||
setContextFlag(true, currentContextFlags);
|
||||
setContextFlag(true, setContextFlags);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ module ts {
|
|||
|
||||
function doInsideOfContext<T>(context: ParserContextFlags, func: () => T): T {
|
||||
let unsetContextFlags = context & ~contextFlags;
|
||||
if (!unsetContextFlags) {
|
||||
if (unsetContextFlags) {
|
||||
setContextFlag(true, unsetContextFlags);
|
||||
let result = func();
|
||||
setContextFlag(false, unsetContextFlags);
|
||||
|
@ -594,11 +594,11 @@ module ts {
|
|||
}
|
||||
|
||||
function allowInAnd<T>(func: () => T): T {
|
||||
return doInsideOfContext(ParserContextFlags.DisallowIn, func);
|
||||
return doOutsideOfContext(ParserContextFlags.DisallowIn, func);
|
||||
}
|
||||
|
||||
function disallowInAnd<T>(func: () => T): T {
|
||||
return doOutsideOfContext(ParserContextFlags.DisallowIn, func);
|
||||
return doInsideOfContext(ParserContextFlags.DisallowIn, func);
|
||||
}
|
||||
|
||||
function doInYieldContext<T>(func: () => T): T {
|
||||
|
@ -772,6 +772,12 @@ module ts {
|
|||
if (token === SyntaxKind.YieldKeyword && inYieldContext()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we have a 'await' keyword, and we're in the [Await] context, then 'await' is
|
||||
// considered a keyword and is not an identifier.
|
||||
if (token === SyntaxKind.AwaitKeyword && inAwaitContext()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return token > SyntaxKind.LastReservedWord;
|
||||
}
|
||||
|
@ -2642,12 +2648,11 @@ module ts {
|
|||
|
||||
function tryParseParenthesizedArrowFunctionExpression(): Expression {
|
||||
let triState = isParenthesizedArrowFunctionExpression();
|
||||
|
||||
if (triState === Tristate.False) {
|
||||
// It's definitely not a parenthesized arrow function expression.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
// If we definitely have an arrow function, then we can just parse one, not requiring a
|
||||
// following => or { token. Otherwise, we *might* have an arrow function. Try to parse
|
||||
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
||||
|
|
|
@ -1304,6 +1304,7 @@ module ts {
|
|||
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
|
||||
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
|
||||
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
|
||||
getPromiseConstructor(node: SignatureDeclaration): EntityName;
|
||||
}
|
||||
|
||||
export const enum SymbolFlags {
|
||||
|
@ -1423,22 +1424,20 @@ module ts {
|
|||
TypeChecked = 0x00000001, // Node has been type checked
|
||||
LexicalThis = 0x00000002, // Lexical 'this' reference
|
||||
CaptureThis = 0x00000004, // Lexical 'this' used in body
|
||||
LexicalArguments = 0x00000008, // Lexical 'arguments' reference
|
||||
CaptureArguments = 0x00000010, // Lexical 'arguments' used in body
|
||||
EmitExtends = 0x00000020, // Emit __extends
|
||||
EmitDecorate = 0x00000040, // Emit __decorate
|
||||
EmitParam = 0x00000080, // Emit __param helper for decorators
|
||||
EmitAwaiter = 0x00000100, // Emit __awaiter
|
||||
EmitGenerator = 0x00000200, // Emit __generator
|
||||
SuperInstance = 0x00000400, // Instance 'super' reference
|
||||
SuperStatic = 0x00000800, // Static 'super' reference
|
||||
ContextChecked = 0x00001000, // Contextual types have been assigned
|
||||
PromiseCollision = 0x00002000, // Declaration collides with the global 'Promise'
|
||||
EmitExtends = 0x00000008, // Emit __extends
|
||||
EmitDecorate = 0x00000010, // Emit __decorate
|
||||
EmitParam = 0x00000020, // Emit __param helper for decorators
|
||||
EmitAwaiter = 0x00000040, // Emit __awaiter
|
||||
EmitGenerator = 0x00000080, // Emit __generator
|
||||
SuperInstance = 0x00000100, // Instance 'super' reference
|
||||
SuperStatic = 0x00000200, // Static 'super' reference
|
||||
ContextChecked = 0x00000400, // Contextual types have been assigned
|
||||
PromiseCollision = 0x00000800, // Declaration collides with the global 'Promise'
|
||||
|
||||
// Values for enum members have been computed, and any errors have been reported for them.
|
||||
EnumValuesComputed = 0x00004000,
|
||||
BlockScopedBindingInLoop = 0x00008000,
|
||||
LexicalModuleMergesWithClass= 0x00010000, // Instantiated lexical module declaration is merged with a previous class declaration.
|
||||
EnumValuesComputed = 0x00001000,
|
||||
BlockScopedBindingInLoop = 0x00002000,
|
||||
LexicalModuleMergesWithClass= 0x00004000, // Instantiated lexical module declaration is merged with a previous class declaration.
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
@ -1456,6 +1455,7 @@ module ts {
|
|||
assignmentChecks?: Map<boolean>; // Cache of assignment checks
|
||||
hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context
|
||||
importOnRightSide?: Symbol; // for import declarations - import that appear on the right side
|
||||
promiseConstructor?: EntityName;
|
||||
}
|
||||
|
||||
export const enum TypeFlags {
|
||||
|
|
|
@ -1705,7 +1705,7 @@ module ts {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) {
|
||||
return (node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node) ||
|
||||
(node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).name === node);
|
||||
|
|
|
@ -1,8 +1,20 @@
|
|||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,10): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,16): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,26): error TS1005: ',' expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,29): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,29): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts(1,34): error TS1005: ';' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration10_es6.ts (5 errors) ====
|
||||
function * foo(a = yield => yield) {
|
||||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
~~~~~~~~~
|
||||
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
~~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,18): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts (2 errors) ====
|
||||
|
@ -7,5 +7,5 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration6_es6.ts(1,1
|
|||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,11): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS2304: Cannot find name 'yield'.
|
||||
tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,20): error TS9000: 'yield' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts (3 errors) ====
|
||||
|
@ -12,6 +12,6 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration7_es6.ts(3,2
|
|||
~
|
||||
!!! error TS9001: Generators are not currently supported.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'yield'.
|
||||
!!! error TS9000: 'yield' expressions are not currently supported.
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts (1 errors) ====
|
||||
|
@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression12_es6.ts(3,6): erro
|
|||
constructor() {
|
||||
yield foo
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts (1 errors) ====
|
||||
|
@ -6,6 +6,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression14_es6.ts(3,6): erro
|
|||
foo() {
|
||||
yield foo
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts(2,6): error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression15_es6.ts (1 errors) ====
|
||||
var v = () => {
|
||||
yield foo
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(1,9): error TS9001: Generators are not currently supported.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts (2 errors) ====
|
||||
|
@ -9,6 +9,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression16_es6.ts(3,5): erro
|
|||
function bar() {
|
||||
yield foo;
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts (3 errors) ====
|
||||
|
@ -10,4 +10,4 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression17_es6.ts(1,23): err
|
|||
~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: 'yield' expression must be contained within a generator declaration.
|
|
@ -1,8 +1,8 @@
|
|||
tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts(2,1): error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression18_es6.ts (1 errors) ====
|
||||
"use strict";
|
||||
yield(foo);
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: 'yield' expression must be contained within a generator declaration.
|
|
@ -1,7 +1,7 @@
|
|||
tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts(1,1): error TS1163: 'yield' expression must be contained within a generator declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression2_es6.ts (1 errors) ====
|
||||
yield foo;
|
||||
~~~~~
|
||||
!!! error TS1163: 'yield' expression must be contained_within a generator declaration.
|
||||
!!! error TS1163: 'yield' expression must be contained within a generator declaration.
|
|
@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]];
|
|||
|
||||
interface myArray extends Array<Number> { }
|
||||
>myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
|
||||
interface myArray2 extends Array<Number|String> { }
|
||||
>myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1439, 1))
|
||||
>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1450, 1))
|
||||
>Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1))
|
||||
>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1549, 1))
|
||||
|
||||
var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[]
|
||||
>d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3))
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,17): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,20): error TS1005: '=' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(2,24): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts(4,11): error TS2304: Cannot find name 'await'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts (5 errors) ====
|
||||
|
||||
var foo = async foo(): Promise<void> => {
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'async'.
|
||||
~~~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
}
|
||||
|
13
tests/baselines/reference/asyncArrowFunction10_es6.js
Normal file
13
tests/baselines/reference/asyncArrowFunction10_es6.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
//// [asyncArrowFunction10_es6.ts]
|
||||
|
||||
var foo = async foo(): Promise<void> => {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
}
|
||||
|
||||
|
||||
//// [asyncArrowFunction10_es6.js]
|
||||
var foo = async, foo = () => {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v;
|
||||
};
|
8
tests/baselines/reference/asyncArrowFunction1_es6.js
Normal file
8
tests/baselines/reference/asyncArrowFunction1_es6.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
//// [asyncArrowFunction1_es6.ts]
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
};
|
||||
|
||||
//// [asyncArrowFunction1_es6.js]
|
||||
var foo = () => __awaiter(function *() {
|
||||
}.apply(this), Promise);
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction1_es6.ts ===
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
>foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
|
||||
|
||||
};
|
8
tests/baselines/reference/asyncArrowFunction1_es6.types
Normal file
8
tests/baselines/reference/asyncArrowFunction1_es6.types
Normal file
|
@ -0,0 +1,8 @@
|
|||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction1_es6.ts ===
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
>foo : () => Promise<void>
|
||||
>async (): Promise<void> => {} : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
};
|
7
tests/baselines/reference/asyncArrowFunction2_es6.js
Normal file
7
tests/baselines/reference/asyncArrowFunction2_es6.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
//// [asyncArrowFunction2_es6.ts]
|
||||
var f = (await) => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction2_es6.js]
|
||||
var f = (await) => {
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction2_es6.ts ===
|
||||
var f = (await) => {
|
||||
>f : Symbol(f, Decl(asyncArrowFunction2_es6.ts, 0, 3))
|
||||
>await : Symbol(await, Decl(asyncArrowFunction2_es6.ts, 0, 9))
|
||||
}
|
6
tests/baselines/reference/asyncArrowFunction2_es6.types
Normal file
6
tests/baselines/reference/asyncArrowFunction2_es6.types
Normal file
|
@ -0,0 +1,6 @@
|
|||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction2_es6.ts ===
|
||||
var f = (await) => {
|
||||
>f : (await: any) => void
|
||||
>(await) => {} : (await: any) => void
|
||||
>await : any
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction3_es6.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction3_es6.ts (1 errors) ====
|
||||
function f(await = await) {
|
||||
~~~~~
|
||||
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
|
||||
}
|
7
tests/baselines/reference/asyncArrowFunction3_es6.js
Normal file
7
tests/baselines/reference/asyncArrowFunction3_es6.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
//// [asyncArrowFunction3_es6.ts]
|
||||
function f(await = await) {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction3_es6.js]
|
||||
function f(await = await) {
|
||||
}
|
7
tests/baselines/reference/asyncArrowFunction4_es6.js
Normal file
7
tests/baselines/reference/asyncArrowFunction4_es6.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
//// [asyncArrowFunction4_es6.ts]
|
||||
var await = () => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction4_es6.js]
|
||||
var await = () => {
|
||||
};
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction4_es6.ts ===
|
||||
var await = () => {
|
||||
>await : Symbol(await, Decl(asyncArrowFunction4_es6.ts, 0, 3))
|
||||
}
|
5
tests/baselines/reference/asyncArrowFunction4_es6.types
Normal file
5
tests/baselines/reference/asyncArrowFunction4_es6.types
Normal file
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction4_es6.ts ===
|
||||
var await = () => {
|
||||
>await : () => void
|
||||
>() => {} : () => void
|
||||
}
|
24
tests/baselines/reference/asyncArrowFunction5_es6.errors.txt
Normal file
24
tests/baselines/reference/asyncArrowFunction5_es6.errors.txt
Normal file
|
@ -0,0 +1,24 @@
|
|||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,18): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,24): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,33): error TS1005: '=' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(2,40): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts (6 errors) ====
|
||||
|
||||
var foo = async (await): Promise<void> => {
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'async'.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
9
tests/baselines/reference/asyncArrowFunction5_es6.js
Normal file
9
tests/baselines/reference/asyncArrowFunction5_es6.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
//// [asyncArrowFunction5_es6.ts]
|
||||
|
||||
var foo = async (await): Promise<void> => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction5_es6.js]
|
||||
var foo = async(await), Promise = ;
|
||||
{
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction6_es6.ts(2,27): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction6_es6.ts (1 errors) ====
|
||||
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
8
tests/baselines/reference/asyncArrowFunction6_es6.js
Normal file
8
tests/baselines/reference/asyncArrowFunction6_es6.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
//// [asyncArrowFunction6_es6.ts]
|
||||
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction6_es6.js]
|
||||
var foo = (...arguments_1) => __awaiter(function *(a = yield ) {
|
||||
}.apply(this, arguments_1), Promise);
|
12
tests/baselines/reference/asyncArrowFunction7_es6.errors.txt
Normal file
12
tests/baselines/reference/asyncArrowFunction7_es6.errors.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction7_es6.ts(4,29): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction7_es6.ts (1 errors) ====
|
||||
|
||||
var bar = async (): Promise<void> => {
|
||||
// 'await' here is an identifier, and not an await expression.
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
}
|
14
tests/baselines/reference/asyncArrowFunction7_es6.js
Normal file
14
tests/baselines/reference/asyncArrowFunction7_es6.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
//// [asyncArrowFunction7_es6.ts]
|
||||
|
||||
var bar = async (): Promise<void> => {
|
||||
// 'await' here is an identifier, and not an await expression.
|
||||
var foo = async (a = await): Promise<void> => {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction7_es6.js]
|
||||
var bar = () => __awaiter(function *() {
|
||||
// 'await' here is an identifier, and not an await expression.
|
||||
var foo = (...arguments_1) => __awaiter(function *(a = yield ) {
|
||||
}.apply(this, arguments_1), Promise);
|
||||
}.apply(this), Promise);
|
10
tests/baselines/reference/asyncArrowFunction8_es6.errors.txt
Normal file
10
tests/baselines/reference/asyncArrowFunction8_es6.errors.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction8_es6.ts(3,19): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction8_es6.ts (1 errors) ====
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
var v = { [await]: foo }
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
10
tests/baselines/reference/asyncArrowFunction8_es6.js
Normal file
10
tests/baselines/reference/asyncArrowFunction8_es6.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
//// [asyncArrowFunction8_es6.ts]
|
||||
|
||||
var foo = async (): Promise<void> => {
|
||||
var v = { [await]: foo }
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction8_es6.js]
|
||||
var foo = () => __awaiter(function *() {
|
||||
var v = { [yield ]: foo };
|
||||
}.apply(this), Promise);
|
23
tests/baselines/reference/asyncArrowFunction9_es6.errors.txt
Normal file
23
tests/baselines/reference/asyncArrowFunction9_es6.errors.txt
Normal file
|
@ -0,0 +1,23 @@
|
|||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,11): error TS2304: Cannot find name 'async'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,18): error TS2304: Cannot find name 'a'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,37): error TS1005: ',' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,46): error TS1005: '=' expected.
|
||||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,53): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts (6 errors) ====
|
||||
var foo = async (a = await => await): Promise<void> => {
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'async'.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
8
tests/baselines/reference/asyncArrowFunction9_es6.js
Normal file
8
tests/baselines/reference/asyncArrowFunction9_es6.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
//// [asyncArrowFunction9_es6.ts]
|
||||
var foo = async (a = await => await): Promise<void> => {
|
||||
}
|
||||
|
||||
//// [asyncArrowFunction9_es6.js]
|
||||
var foo = async(a = await => await), Promise = ;
|
||||
{
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es6.ts(4,52): error TS2522: The 'arguments' object cannot be referenced in an async arrow function Consider using a standard async function expression.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es6.ts (1 errors) ====
|
||||
class C {
|
||||
method() {
|
||||
function other() {}
|
||||
var fn = async () => await other.apply(this, arguments);
|
||||
~~~~~~~~~
|
||||
!!! error TS2522: The 'arguments' object cannot be referenced in an async arrow function Consider using a standard async function expression.
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
//// [asyncArrowFunctionCapturesArguments_es6.ts]
|
||||
class C {
|
||||
method() {
|
||||
function other() {}
|
||||
var fn = async () => await other.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [asyncArrowFunctionCapturesArguments_es6.js]
|
||||
class C {
|
||||
method() {
|
||||
function other() { }
|
||||
var fn = () => __awaiter(function *() { return yield other.apply(this, arguments); }.apply(this));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
//// [asyncArrowFunctionCapturesThis_es6.ts]
|
||||
class C {
|
||||
method() {
|
||||
var fn = async () => await this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [asyncArrowFunctionCapturesThis_es6.js]
|
||||
class C {
|
||||
method() {
|
||||
var fn = () => __awaiter(function *() { return yield this; }.apply(this));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunctionCapturesThis_es6.ts ===
|
||||
class C {
|
||||
>C : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 0))
|
||||
|
||||
method() {
|
||||
>method : Symbol(method, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 9))
|
||||
|
||||
var fn = async () => await this;
|
||||
>fn : Symbol(fn, Decl(asyncArrowFunctionCapturesThis_es6.ts, 2, 9))
|
||||
>this : Symbol(C, Decl(asyncArrowFunctionCapturesThis_es6.ts, 0, 0))
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunctionCapturesThis_es6.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
method() {
|
||||
>method : () => void
|
||||
|
||||
var fn = async () => await this;
|
||||
>fn : () => Promise<C>
|
||||
>async () => await this : () => Promise<C>
|
||||
>this : C
|
||||
}
|
||||
}
|
||||
|
8
tests/baselines/reference/asyncClass_es6.errors.txt
Normal file
8
tests/baselines/reference/asyncClass_es6.errors.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
tests/cases/conformance/async/es6/asyncClass_es6.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncClass_es6.ts (1 errors) ====
|
||||
async class C {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
7
tests/baselines/reference/asyncClass_es6.js
Normal file
7
tests/baselines/reference/asyncClass_es6.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
//// [asyncClass_es6.ts]
|
||||
async class C {
|
||||
}
|
||||
|
||||
//// [asyncClass_es6.js]
|
||||
class C {
|
||||
}
|
10
tests/baselines/reference/asyncConstructor_es6.errors.txt
Normal file
10
tests/baselines/reference/asyncConstructor_es6.errors.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
tests/cases/conformance/async/es6/asyncConstructor_es6.ts(2,3): error TS1089: 'async' modifier cannot appear on a constructor declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncConstructor_es6.ts (1 errors) ====
|
||||
class C {
|
||||
async constructor() {
|
||||
~~~~~
|
||||
!!! error TS1089: 'async' modifier cannot appear on a constructor declaration.
|
||||
}
|
||||
}
|
11
tests/baselines/reference/asyncConstructor_es6.js
Normal file
11
tests/baselines/reference/asyncConstructor_es6.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [asyncConstructor_es6.ts]
|
||||
class C {
|
||||
async constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncConstructor_es6.js]
|
||||
class C {
|
||||
constructor() {
|
||||
}
|
||||
}
|
7
tests/baselines/reference/asyncDeclare_es6.errors.txt
Normal file
7
tests/baselines/reference/asyncDeclare_es6.errors.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
tests/cases/conformance/async/es6/asyncDeclare_es6.ts(1,9): error TS1040: 'async' modifier cannot be used in an ambient context.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncDeclare_es6.ts (1 errors) ====
|
||||
declare async function foo(): Promise<void>;
|
||||
~~~~~
|
||||
!!! error TS1040: 'async' modifier cannot be used in an ambient context.
|
4
tests/baselines/reference/asyncDeclare_es6.js
Normal file
4
tests/baselines/reference/asyncDeclare_es6.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
//// [asyncDeclare_es6.ts]
|
||||
declare async function foo(): Promise<void>;
|
||||
|
||||
//// [asyncDeclare_es6.js]
|
9
tests/baselines/reference/asyncEnum_es6.errors.txt
Normal file
9
tests/baselines/reference/asyncEnum_es6.errors.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/async/es6/asyncEnum_es6.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncEnum_es6.ts (1 errors) ====
|
||||
async enum E {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
Value
|
||||
}
|
10
tests/baselines/reference/asyncEnum_es6.js
Normal file
10
tests/baselines/reference/asyncEnum_es6.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
//// [asyncEnum_es6.ts]
|
||||
async enum E {
|
||||
Value
|
||||
}
|
||||
|
||||
//// [asyncEnum_es6.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["Value"] = 0] = "Value";
|
||||
})(E || (E = {}));
|
|
@ -0,0 +1,26 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,30): error TS1109: Expression expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,33): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,33): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,38): error TS1005: ';' expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,39): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts(1,53): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts (7 errors) ====
|
||||
async function foo(a = await => await): Promise<void> {
|
||||
~~~~~~~~~
|
||||
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
||||
~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
//// [asyncFunctionDeclaration10_es6.ts]
|
||||
async function foo(a = await => await): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration10_es6.js]
|
||||
await;
|
||||
Promise < void > {};
|
|
@ -0,0 +1,9 @@
|
|||
//// [asyncFunctionDeclaration11_es6.ts]
|
||||
async function await(): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration11_es6.js]
|
||||
function await() {
|
||||
return __awaiter(function *() {
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
|
||||
async function await(): Promise<void> {
|
||||
>await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts ===
|
||||
async function await(): Promise<void> {
|
||||
>await : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,29): error TS1005: '=' expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,33): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts(1,47): error TS1005: '=>' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts (4 errors) ====
|
||||
var v = async function await(): Promise<void> { }
|
||||
~~~~~
|
||||
!!! error TS1005: '(' expected.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement.
|
||||
~
|
||||
!!! error TS1005: '=>' expected.
|
|
@ -0,0 +1,5 @@
|
|||
//// [asyncFunctionDeclaration12_es6.ts]
|
||||
var v = async function await(): Promise<void> { }
|
||||
|
||||
//// [asyncFunctionDeclaration12_es6.js]
|
||||
var v = , await = () => { };
|
|
@ -0,0 +1,11 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration13_es6.ts(3,11): error TS2304: Cannot find name 'await'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration13_es6.ts (1 errors) ====
|
||||
async function foo(): Promise<void> {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
}
|
||||
|
14
tests/baselines/reference/asyncFunctionDeclaration13_es6.js
Normal file
14
tests/baselines/reference/asyncFunctionDeclaration13_es6.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
//// [asyncFunctionDeclaration13_es6.ts]
|
||||
async function foo(): Promise<void> {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v: await;
|
||||
}
|
||||
|
||||
|
||||
//// [asyncFunctionDeclaration13_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(function *() {
|
||||
// Legal to use 'await' in a type context.
|
||||
var v;
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
11
tests/baselines/reference/asyncFunctionDeclaration14_es6.js
Normal file
11
tests/baselines/reference/asyncFunctionDeclaration14_es6.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [asyncFunctionDeclaration14_es6.ts]
|
||||
async function foo(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration14_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(function *() {
|
||||
return;
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
|
||||
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
return;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
//// [asyncFunctionDeclaration1_es6.ts]
|
||||
async function foo(): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration1_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(function *() {
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts ===
|
||||
async function foo(): Promise<void> {
|
||||
>foo : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
//// [asyncFunctionDeclaration2_es6.ts]
|
||||
function f(await) {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration2_es6.js]
|
||||
function f(await) {
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration2_es6.ts ===
|
||||
function f(await) {
|
||||
>f : Symbol(f, Decl(asyncFunctionDeclaration2_es6.ts, 0, 0))
|
||||
>await : Symbol(await, Decl(asyncFunctionDeclaration2_es6.ts, 0, 11))
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration2_es6.ts ===
|
||||
function f(await) {
|
||||
>f : (await: any) => void
|
||||
>await : any
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration3_es6.ts(1,20): error TS2372: Parameter 'await' cannot be referenced in its initializer.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration3_es6.ts (1 errors) ====
|
||||
function f(await = await) {
|
||||
~~~~~
|
||||
!!! error TS2372: Parameter 'await' cannot be referenced in its initializer.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
//// [asyncFunctionDeclaration3_es6.ts]
|
||||
function f(await = await) {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration3_es6.js]
|
||||
function f(await = await) {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
//// [asyncFunctionDeclaration4_es6.ts]
|
||||
function await() {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration4_es6.js]
|
||||
function await() {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration4_es6.ts ===
|
||||
function await() {
|
||||
>await : Symbol(await, Decl(asyncFunctionDeclaration4_es6.ts, 0, 0))
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration4_es6.ts ===
|
||||
function await() {
|
||||
>await : () => void
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,20): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,20): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,25): error TS1005: ';' expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,26): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts(1,40): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts (5 errors) ====
|
||||
async function foo(await): Promise<void> {
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
//// [asyncFunctionDeclaration5_es6.ts]
|
||||
async function foo(await): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration5_es6.js]
|
||||
await;
|
||||
Promise < void > {};
|
|
@ -0,0 +1,8 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration6_es6.ts(1,29): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration6_es6.ts (1 errors) ====
|
||||
async function foo(a = await): Promise<void> {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
//// [asyncFunctionDeclaration6_es6.ts]
|
||||
async function foo(a = await): Promise<void> {
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration6_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(function *(a = yield ) {
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration7_es6.ts(3,31): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration7_es6.ts (1 errors) ====
|
||||
async function bar(): Promise<void> {
|
||||
// 'await' here is an identifier, and not a yield expression.
|
||||
async function foo(a = await): Promise<void> {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
}
|
17
tests/baselines/reference/asyncFunctionDeclaration7_es6.js
Normal file
17
tests/baselines/reference/asyncFunctionDeclaration7_es6.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
//// [asyncFunctionDeclaration7_es6.ts]
|
||||
async function bar(): Promise<void> {
|
||||
// 'await' here is an identifier, and not a yield expression.
|
||||
async function foo(a = await): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration7_es6.js]
|
||||
function bar() {
|
||||
return __awaiter(function *() {
|
||||
// 'await' here is an identifier, and not a yield expression.
|
||||
function foo() {
|
||||
return __awaiter(function *(a = yield ) {
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'await'.
|
||||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration8_es6.ts (2 errors) ====
|
||||
var v = { [await]: foo }
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'await'.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
|
@ -0,0 +1,5 @@
|
|||
//// [asyncFunctionDeclaration8_es6.ts]
|
||||
var v = { [await]: foo }
|
||||
|
||||
//// [asyncFunctionDeclaration8_es6.js]
|
||||
var v = { [await]: foo };
|
|
@ -0,0 +1,9 @@
|
|||
tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration9_es6.ts(2,19): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration9_es6.ts (1 errors) ====
|
||||
async function foo(): Promise<void> {
|
||||
var v = { [await]: foo }
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
11
tests/baselines/reference/asyncFunctionDeclaration9_es6.js
Normal file
11
tests/baselines/reference/asyncFunctionDeclaration9_es6.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [asyncFunctionDeclaration9_es6.ts]
|
||||
async function foo(): Promise<void> {
|
||||
var v = { [await]: foo }
|
||||
}
|
||||
|
||||
//// [asyncFunctionDeclaration9_es6.js]
|
||||
function foo() {
|
||||
return __awaiter(function *() {
|
||||
var v = { [yield ]: foo };
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
13
tests/baselines/reference/asyncGetter_es6.errors.txt
Normal file
13
tests/baselines/reference/asyncGetter_es6.errors.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
tests/cases/conformance/async/es6/asyncGetter_es6.ts(2,3): error TS1042: 'async' modifier cannot be used here.
|
||||
tests/cases/conformance/async/es6/asyncGetter_es6.ts(2,13): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncGetter_es6.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 or consist of a single 'throw' statement.
|
||||
}
|
||||
}
|
11
tests/baselines/reference/asyncGetter_es6.js
Normal file
11
tests/baselines/reference/asyncGetter_es6.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [asyncGetter_es6.ts]
|
||||
class C {
|
||||
async get foo() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncGetter_es6.js]
|
||||
class C {
|
||||
get foo() {
|
||||
}
|
||||
}
|
8
tests/baselines/reference/asyncInterface_es6.errors.txt
Normal file
8
tests/baselines/reference/asyncInterface_es6.errors.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
tests/cases/conformance/async/es6/asyncInterface_es6.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncInterface_es6.ts (1 errors) ====
|
||||
async interface I {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
5
tests/baselines/reference/asyncInterface_es6.js
Normal file
5
tests/baselines/reference/asyncInterface_es6.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
//// [asyncInterface_es6.ts]
|
||||
async interface I {
|
||||
}
|
||||
|
||||
//// [asyncInterface_es6.js]
|
8
tests/baselines/reference/asyncModule_es6.errors.txt
Normal file
8
tests/baselines/reference/asyncModule_es6.errors.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
tests/cases/conformance/async/es6/asyncModule_es6.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncModule_es6.ts (1 errors) ====
|
||||
async module M {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
5
tests/baselines/reference/asyncModule_es6.js
Normal file
5
tests/baselines/reference/asyncModule_es6.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
//// [asyncModule_es6.ts]
|
||||
async module M {
|
||||
}
|
||||
|
||||
//// [asyncModule_es6.js]
|
10
tests/baselines/reference/asyncSetter_es6.errors.txt
Normal file
10
tests/baselines/reference/asyncSetter_es6.errors.txt
Normal file
|
@ -0,0 +1,10 @@
|
|||
tests/cases/conformance/async/es6/asyncSetter_es6.ts(2,3): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es6/asyncSetter_es6.ts (1 errors) ====
|
||||
class C {
|
||||
async set foo(value) {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
}
|
11
tests/baselines/reference/asyncSetter_es6.js
Normal file
11
tests/baselines/reference/asyncSetter_es6.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [asyncSetter_es6.ts]
|
||||
class C {
|
||||
async set foo(value) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncSetter_es6.js]
|
||||
class C {
|
||||
set foo(value) {
|
||||
}
|
||||
}
|
17
tests/baselines/reference/awaitBinaryExpression1_es6.js
Normal file
17
tests/baselines/reference/awaitBinaryExpression1_es6.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
//// [awaitBinaryExpression1_es6.ts]
|
||||
declare var a: boolean;
|
||||
declare var p: Promise<boolean>;
|
||||
async function func(): Promise<void> {
|
||||
"before";
|
||||
var b = await p || a;
|
||||
"after";
|
||||
}
|
||||
|
||||
//// [awaitBinaryExpression1_es6.js]
|
||||
function func() {
|
||||
return __awaiter(function *() {
|
||||
"before";
|
||||
var b = (yield p) || a;
|
||||
"after";
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
19
tests/baselines/reference/awaitBinaryExpression1_es6.symbols
Normal file
19
tests/baselines/reference/awaitBinaryExpression1_es6.symbols
Normal file
|
@ -0,0 +1,19 @@
|
|||
=== tests/cases/conformance/async/es6/awaitBinaryExpression/awaitBinaryExpression1_es6.ts ===
|
||||
declare var a: boolean;
|
||||
>a : Symbol(a, Decl(awaitBinaryExpression1_es6.ts, 0, 11))
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
|
||||
|
||||
"before";
|
||||
var b = await p || a;
|
||||
>b : Symbol(b, Decl(awaitBinaryExpression1_es6.ts, 4, 7))
|
||||
>a : Symbol(a, Decl(awaitBinaryExpression1_es6.ts, 0, 11))
|
||||
|
||||
"after";
|
||||
}
|
24
tests/baselines/reference/awaitBinaryExpression1_es6.types
Normal file
24
tests/baselines/reference/awaitBinaryExpression1_es6.types
Normal file
|
@ -0,0 +1,24 @@
|
|||
=== tests/cases/conformance/async/es6/awaitBinaryExpression/awaitBinaryExpression1_es6.ts ===
|
||||
declare var a: boolean;
|
||||
>a : boolean
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Promise<boolean>
|
||||
>Promise : Promise<T>
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
"before";
|
||||
>"before" : string
|
||||
|
||||
var b = await p || a;
|
||||
>b : boolean
|
||||
>await p || a : boolean
|
||||
>p : any
|
||||
>a : boolean
|
||||
|
||||
"after";
|
||||
>"after" : string
|
||||
}
|
17
tests/baselines/reference/awaitBinaryExpression2_es6.js
Normal file
17
tests/baselines/reference/awaitBinaryExpression2_es6.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
//// [awaitBinaryExpression2_es6.ts]
|
||||
declare var a: boolean;
|
||||
declare var p: Promise<boolean>;
|
||||
async function func(): Promise<void> {
|
||||
"before";
|
||||
var b = await p && a;
|
||||
"after";
|
||||
}
|
||||
|
||||
//// [awaitBinaryExpression2_es6.js]
|
||||
function func() {
|
||||
return __awaiter(function *() {
|
||||
"before";
|
||||
var b = (yield p) && a;
|
||||
"after";
|
||||
}.apply(this, arguments), Promise);
|
||||
}
|
19
tests/baselines/reference/awaitBinaryExpression2_es6.symbols
Normal file
19
tests/baselines/reference/awaitBinaryExpression2_es6.symbols
Normal file
|
@ -0,0 +1,19 @@
|
|||
=== tests/cases/conformance/async/es6/awaitBinaryExpression/awaitBinaryExpression2_es6.ts ===
|
||||
declare var a: boolean;
|
||||
>a : Symbol(a, Decl(awaitBinaryExpression2_es6.ts, 0, 11))
|
||||
|
||||
declare var p: Promise<boolean>;
|
||||
>p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
|
||||
|
||||
async function func(): Promise<void> {
|
||||
>func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32))
|
||||
>Promise : Symbol(Promise, Decl(lib.d.ts, 4769, 1), Decl(lib.d.ts, 4853, 11))
|
||||
|
||||
"before";
|
||||
var b = await p && a;
|
||||
>b : Symbol(b, Decl(awaitBinaryExpression2_es6.ts, 4, 7))
|
||||
>a : Symbol(a, Decl(awaitBinaryExpression2_es6.ts, 0, 11))
|
||||
|
||||
"after";
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue