mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 17:41:26 -06:00
Move async generators to esnext
This commit is contained in:
parent
0d7c9dc4e0
commit
6a737c88f7
11
Gulpfile.ts
11
Gulpfile.ts
@ -136,6 +136,14 @@ const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) {
|
||||
return { target: "lib." + source, sources: ["header.d.ts", source] };
|
||||
});
|
||||
|
||||
const esnextLibrarySource = [
|
||||
"esnext.asynciterable.d.ts"
|
||||
];
|
||||
|
||||
const esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {
|
||||
return { target: "lib." + source, sources: ["header.d.ts", source] };
|
||||
});
|
||||
|
||||
const hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
|
||||
|
||||
const librarySourceMap = [
|
||||
@ -150,11 +158,12 @@ const librarySourceMap = [
|
||||
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
|
||||
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
|
||||
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
|
||||
{ target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] },
|
||||
|
||||
// JavaScript + all host library
|
||||
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
|
||||
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
|
||||
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);
|
||||
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
|
||||
|
||||
const libraryTargets = librarySourceMap.map(function(f) {
|
||||
return path.join(builtLocalDirectory, f.target);
|
||||
|
||||
14
Jakefile.js
14
Jakefile.js
@ -305,14 +305,21 @@ var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) {
|
||||
var es2017LibrarySource = [
|
||||
"es2017.object.d.ts",
|
||||
"es2017.sharedmemory.d.ts",
|
||||
"es2017.string.d.ts",
|
||||
"es2017.asynciterable.d.ts"
|
||||
"es2017.string.d.ts"
|
||||
];
|
||||
|
||||
var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
|
||||
return { target: "lib." + source, sources: ["header.d.ts", source] };
|
||||
});
|
||||
|
||||
var esnextLibrarySource = [
|
||||
"esnext.asynciterable.d.ts"
|
||||
];
|
||||
|
||||
var esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {
|
||||
return { target: "lib." + source, sources: ["header.d.ts", source] };
|
||||
});
|
||||
|
||||
var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
|
||||
|
||||
var librarySourceMap = [
|
||||
@ -327,11 +334,12 @@ var librarySourceMap = [
|
||||
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
|
||||
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
|
||||
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
|
||||
{ target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] },
|
||||
|
||||
// JavaScript + all host library
|
||||
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
|
||||
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
|
||||
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);
|
||||
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
|
||||
|
||||
var libraryTargets = librarySourceMap.map(function (f) {
|
||||
return path.join(builtLocalDirectory, f.target);
|
||||
|
||||
@ -2791,7 +2791,7 @@ namespace ts {
|
||||
|
||||
// An async method declaration is ES2017 syntax.
|
||||
if (hasModifier(node, ModifierFlags.Async)) {
|
||||
transformFlags |= TransformFlags.AssertES2017;
|
||||
transformFlags |= node.asteriskToken ? TransformFlags.AssertESNext : TransformFlags.AssertES2017;
|
||||
}
|
||||
|
||||
// Currently, we only support generators that were originally async function bodies.
|
||||
@ -2861,7 +2861,7 @@ namespace ts {
|
||||
|
||||
// An async function declaration is ES2017 syntax.
|
||||
if (modifierFlags & ModifierFlags.Async) {
|
||||
transformFlags |= TransformFlags.AssertES2017;
|
||||
transformFlags |= node.asteriskToken ? TransformFlags.AssertESNext : TransformFlags.AssertES2017;
|
||||
}
|
||||
|
||||
// function declarations with object rest destructuring are ES Next syntax
|
||||
@ -2903,7 +2903,7 @@ namespace ts {
|
||||
|
||||
// An async function expression is ES2017 syntax.
|
||||
if (hasModifier(node, ModifierFlags.Async)) {
|
||||
transformFlags |= TransformFlags.AssertES2017;
|
||||
transformFlags |= node.asteriskToken ? TransformFlags.AssertESNext : TransformFlags.AssertES2017;
|
||||
}
|
||||
|
||||
// function expressions with object rest destructuring are ES Next syntax
|
||||
@ -3092,8 +3092,8 @@ namespace ts {
|
||||
switch (kind) {
|
||||
case SyntaxKind.AsyncKeyword:
|
||||
case SyntaxKind.AwaitExpression:
|
||||
// async/await is ES2017 syntax
|
||||
transformFlags |= TransformFlags.AssertES2017;
|
||||
// async/await is ES2017 syntax, but may be ESNext syntax (for async generators)
|
||||
transformFlags |= TransformFlags.AssertESNext | TransformFlags.AssertES2017;
|
||||
break;
|
||||
|
||||
case SyntaxKind.PublicKeyword:
|
||||
@ -3124,14 +3124,6 @@ namespace ts {
|
||||
transformFlags |= TransformFlags.AssertJsx;
|
||||
break;
|
||||
|
||||
case SyntaxKind.ForOfStatement:
|
||||
if ((<ForOfStatement>node).awaitModifier) {
|
||||
transformFlags |= TransformFlags.AssertES2017;
|
||||
}
|
||||
|
||||
transformFlags |= TransformFlags.AssertES2015;
|
||||
break;
|
||||
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.TemplateHead:
|
||||
case SyntaxKind.TemplateMiddle:
|
||||
@ -3148,7 +3140,7 @@ namespace ts {
|
||||
case SyntaxKind.ForOfStatement:
|
||||
// This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of).
|
||||
if ((<ForOfStatement>node).awaitModifier) {
|
||||
transformFlags |= TransformFlags.AssertES2017;
|
||||
transformFlags |= TransformFlags.AssertESNext;
|
||||
}
|
||||
transformFlags |= TransformFlags.AssertES2015;
|
||||
break;
|
||||
@ -3156,7 +3148,7 @@ namespace ts {
|
||||
case SyntaxKind.YieldExpression:
|
||||
// This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async
|
||||
// generator).
|
||||
transformFlags |= TransformFlags.AssertES2017 | TransformFlags.AssertES2015 | TransformFlags.ContainsYield;
|
||||
transformFlags |= TransformFlags.AssertESNext | TransformFlags.AssertES2015 | TransformFlags.ContainsYield;
|
||||
break;
|
||||
|
||||
case SyntaxKind.AnyKeyword:
|
||||
|
||||
@ -426,6 +426,7 @@ namespace ts {
|
||||
"es7": "lib.es2016.d.ts",
|
||||
"es2016": "lib.es2016.d.ts",
|
||||
"es2017": "lib.es2017.d.ts",
|
||||
"esnext": "lib.esnext.d.ts",
|
||||
// Host only
|
||||
"dom": "lib.dom.d.ts",
|
||||
"dom.iterable": "lib.dom.iterable.d.ts",
|
||||
@ -445,7 +446,7 @@ namespace ts {
|
||||
"es2017.object": "lib.es2017.object.d.ts",
|
||||
"es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts",
|
||||
"es2017.string": "lib.es2017.string.d.ts",
|
||||
"es2017.asynciterable": "lib.es2017.asynciterable.d.ts",
|
||||
"esnext.asynciterable": "lib.esnext.asynciterable.d.ts",
|
||||
}),
|
||||
},
|
||||
description: Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon
|
||||
|
||||
@ -1866,9 +1866,8 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
else {
|
||||
const expression = node;
|
||||
const updatedExpression = createAssignment(expression, boundValue, /*location*/ expression);
|
||||
return createStatement(updatedExpression, /*location*/ expression);
|
||||
const updatedExpression = createAssignment(node, boundValue, /*location*/ node);
|
||||
return createStatement(updatedExpression, /*location*/ node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2149,6 +2149,20 @@ namespace ts {
|
||||
: restoreEnclosingLabel(visitNode(statement, visitor, isStatement), node, convertedLoopState && resetLabel);
|
||||
}
|
||||
|
||||
function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
return visitDoOrWhileStatement(<DoStatement | WhileStatement>node, outermostLabeledStatement);
|
||||
case SyntaxKind.ForStatement:
|
||||
return visitForStatement(<ForStatement>node, outermostLabeledStatement);
|
||||
case SyntaxKind.ForInStatement:
|
||||
return visitForInStatement(<ForInStatement>node, outermostLabeledStatement);
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return visitForOfStatement(<ForOfStatement>node, outermostLabeledStatement);
|
||||
}
|
||||
}
|
||||
|
||||
function visitIterationStatementWithFacts(excludeFacts: HierarchyFacts, includeFacts: HierarchyFacts, node: IterationStatement, outermostLabeledStatement: LabeledStatement, convert?: LoopConverter) {
|
||||
const ancestorFacts = enterSubtree(excludeFacts, includeFacts);
|
||||
const updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert);
|
||||
@ -2488,20 +2502,6 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
function visitIterationStatement(node: IterationStatement, outermostLabeledStatement: LabeledStatement) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.WhileStatement:
|
||||
return visitDoOrWhileStatement(<DoStatement | WhileStatement>node, outermostLabeledStatement);
|
||||
case SyntaxKind.ForStatement:
|
||||
return visitForStatement(<ForStatement>node, outermostLabeledStatement);
|
||||
case SyntaxKind.ForInStatement:
|
||||
return visitForInStatement(<ForInStatement>node, outermostLabeledStatement);
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return visitForOfStatement(<ForOfStatement>node, outermostLabeledStatement);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits an ObjectLiteralExpression with computed propety names.
|
||||
*
|
||||
|
||||
@ -14,8 +14,7 @@ namespace ts {
|
||||
const {
|
||||
startLexicalEnvironment,
|
||||
resumeLexicalEnvironment,
|
||||
endLexicalEnvironment,
|
||||
hoistVariableDeclaration
|
||||
endLexicalEnvironment
|
||||
} = context;
|
||||
|
||||
const resolver = context.getEmitResolver();
|
||||
@ -35,8 +34,7 @@ namespace ts {
|
||||
* This keeps track of containers where `super` is valid, for use with
|
||||
* just-in-time substitution for `super` expressions inside of async methods.
|
||||
*/
|
||||
let currentSuperContainer: SuperContainer;
|
||||
let enclosingFunctionFlags: FunctionFlags;
|
||||
let enclosingSuperContainerFlags: NodeCheckFlags = 0;
|
||||
|
||||
// Save the previous transformation hooks.
|
||||
const previousOnEmitNode = context.onEmitNode;
|
||||
@ -73,46 +71,20 @@ namespace ts {
|
||||
return undefined;
|
||||
|
||||
case SyntaxKind.AwaitExpression:
|
||||
// ES2017 'await' expressions must be transformed for targets < ES2017.
|
||||
return visitAwaitExpression(<AwaitExpression>node);
|
||||
case SyntaxKind.YieldExpression:
|
||||
// ES2017 'yield' expressions in an async generator must be transformed
|
||||
// for targets < ES2017.
|
||||
return visitYieldExpression(<YieldExpression>node);
|
||||
|
||||
case SyntaxKind.LabeledStatement:
|
||||
return visitLabeledStatement(<LabeledStatement>node);
|
||||
|
||||
case SyntaxKind.ForOfStatement:
|
||||
// ES2017 'for-await-of' statements must be transformed for targets <
|
||||
// ES2017.
|
||||
return visitForOfStatement(<ForOfStatement>node, /*enclosingLabeledStatements*/ undefined);
|
||||
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
// ES2017 method declarations may be 'async'
|
||||
return visitMethodDeclaration(<MethodDeclaration>node);
|
||||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
// ES2017 function declarations may be 'async'
|
||||
return visitFunctionDeclaration(<FunctionDeclaration>node);
|
||||
|
||||
case SyntaxKind.FunctionExpression:
|
||||
// ES2017 function expressions may be 'async'
|
||||
return visitFunctionExpression(<FunctionExpression>node);
|
||||
|
||||
case SyntaxKind.ArrowFunction:
|
||||
// ES2017 arrow functions may be 'async'
|
||||
return visitArrowFunction(<ArrowFunction>node);
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetKeyword:
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(<FunctionLikeDeclaration>node);
|
||||
const visited = visitEachChild(node, visitor, context);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return visited;
|
||||
|
||||
default:
|
||||
return visitEachChild(node, visitor, context);
|
||||
}
|
||||
@ -126,202 +98,16 @@ namespace ts {
|
||||
* @param node The node to visit.
|
||||
*/
|
||||
function visitAwaitExpression(node: AwaitExpression): Expression {
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
return setOriginalNode(
|
||||
createYield(
|
||||
/*asteriskToken*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Generator ?
|
||||
createArrayLiteral([createLiteral("await"), expression]) :
|
||||
expression,
|
||||
visitNode(node.expression, visitor, isExpression),
|
||||
/*location*/ node
|
||||
),
|
||||
node
|
||||
);
|
||||
}
|
||||
|
||||
function visitYieldExpression(node: YieldExpression): Expression {
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
return updateYield(
|
||||
node,
|
||||
enclosingFunctionFlags & FunctionFlags.Async ?
|
||||
node.asteriskToken ?
|
||||
createAsyncDelegatorHelper(context, expression, expression) :
|
||||
createArrayLiteral(
|
||||
expression ?
|
||||
[createLiteral("yield"), expression] :
|
||||
[createLiteral("yield")]
|
||||
) :
|
||||
expression
|
||||
);
|
||||
}
|
||||
|
||||
function visitLabeledStatement(node: LabeledStatement): VisitResult<Statement> {
|
||||
const statement = unwrapInnermostStatmentOfLabel(node);
|
||||
if (statement.kind === SyntaxKind.ForOfStatement &&
|
||||
(<ForOfStatement>statement).awaitModifier) {
|
||||
return visitForOfStatement(<ForOfStatement>statement, node);
|
||||
}
|
||||
|
||||
return restoreEnclosingLabel(visitEachChild(node, visitor, context), node);
|
||||
}
|
||||
|
||||
function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement): VisitResult<Statement> {
|
||||
if (!node.awaitModifier) return visitEachChild(node, visitor, context);
|
||||
|
||||
let bodyLocation: TextRange;
|
||||
let statementsLocation: TextRange;
|
||||
const iteratorRecord = isIdentifier(node.expression)
|
||||
? getGeneratedNameForNode(node.expression)
|
||||
: createUniqueName("iterator");
|
||||
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
const statements: Statement[] = [];
|
||||
const binding = createForOfBindingStatement(
|
||||
node.initializer,
|
||||
createPropertyAccess(
|
||||
createPropertyAccess(iteratorRecord, "result"),
|
||||
"value"
|
||||
)
|
||||
);
|
||||
statements.push(visitNode(binding, visitor, isStatement));
|
||||
const statement = visitNode(node.statement, visitor, isStatement);
|
||||
if (isBlock(statement)) {
|
||||
addRange(statements, statement.statements);
|
||||
bodyLocation = statement;
|
||||
statementsLocation = statement.statements;
|
||||
}
|
||||
else {
|
||||
statements.push(statement);
|
||||
}
|
||||
|
||||
const step = createAsyncStepHelper(
|
||||
context,
|
||||
iteratorRecord,
|
||||
node.initializer
|
||||
);
|
||||
|
||||
let outerStatement: Statement = setEmitFlags(
|
||||
createFor(
|
||||
createVariableDeclarationList(
|
||||
[
|
||||
createVariableDeclaration(
|
||||
iteratorRecord,
|
||||
/*type*/ undefined,
|
||||
createObjectLiteral(
|
||||
[
|
||||
createPropertyAssignment(
|
||||
"iterator",
|
||||
createAsyncValuesHelper(
|
||||
context,
|
||||
expression,
|
||||
node.expression
|
||||
),
|
||||
node.expression
|
||||
)
|
||||
],
|
||||
node.expression
|
||||
),
|
||||
node.expression
|
||||
)
|
||||
],
|
||||
node.expression
|
||||
),
|
||||
/*condition*/ createYield(
|
||||
/*asteriskToken*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Generator ?
|
||||
createArrayLiteral([createLiteral("await"), step]) :
|
||||
step,
|
||||
node.initializer
|
||||
),
|
||||
/*incrementor*/ undefined,
|
||||
setEmitFlags(
|
||||
createBlock(
|
||||
createNodeArray(statements, statementsLocation),
|
||||
bodyLocation,
|
||||
/*multiLine*/ true
|
||||
),
|
||||
EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps
|
||||
),
|
||||
/*location*/ node
|
||||
),
|
||||
EmitFlags.NoTokenTrailingSourceMaps
|
||||
);
|
||||
|
||||
outerStatement = restoreEnclosingLabel(outerStatement, outermostLabeledStatement);
|
||||
return closeAsyncIterator(outerStatement, iteratorRecord);
|
||||
}
|
||||
|
||||
function closeAsyncIterator(statement: Statement, iteratorRecord: Expression) {
|
||||
const errorRecord = createUniqueName("e");
|
||||
hoistVariableDeclaration(errorRecord);
|
||||
const catchVariable = getGeneratedNameForNode(errorRecord);
|
||||
const close = createCloseHelper(
|
||||
context,
|
||||
iteratorRecord
|
||||
);
|
||||
return createTry(
|
||||
createBlock([
|
||||
statement
|
||||
]),
|
||||
createCatchClause(catchVariable,
|
||||
setEmitFlags(
|
||||
createBlock([
|
||||
createStatement(
|
||||
createAssignment(
|
||||
errorRecord,
|
||||
createObjectLiteral([
|
||||
createPropertyAssignment(
|
||||
"error",
|
||||
catchVariable
|
||||
)
|
||||
])
|
||||
)
|
||||
)
|
||||
]),
|
||||
EmitFlags.SingleLine
|
||||
)
|
||||
),
|
||||
createBlock([
|
||||
setEmitFlags(
|
||||
createTry(
|
||||
setEmitFlags(
|
||||
createBlock([
|
||||
createStatement(
|
||||
createYield(
|
||||
/*asteriskToken*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Generator ?
|
||||
createArrayLiteral([createLiteral("await"), close]) :
|
||||
close
|
||||
)
|
||||
)
|
||||
]),
|
||||
EmitFlags.SingleLine
|
||||
),
|
||||
undefined,
|
||||
setEmitFlags(
|
||||
createBlock([
|
||||
setEmitFlags(
|
||||
createIf(
|
||||
errorRecord,
|
||||
createThrow(
|
||||
createPropertyAccess(
|
||||
errorRecord,
|
||||
"error"
|
||||
)
|
||||
)
|
||||
),
|
||||
EmitFlags.SingleLine
|
||||
)
|
||||
]),
|
||||
EmitFlags.SingleLine
|
||||
)
|
||||
),
|
||||
EmitFlags.SingleLine
|
||||
)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits a MethodDeclaration node.
|
||||
*
|
||||
@ -331,25 +117,19 @@ namespace ts {
|
||||
* @param node The node to visit.
|
||||
*/
|
||||
function visitMethodDeclaration(node: MethodDeclaration) {
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(node);
|
||||
const updated = updateMethod(
|
||||
return updateMethod(
|
||||
node,
|
||||
/*decorators*/ undefined,
|
||||
visitNodes(node.modifiers, visitor, isModifier),
|
||||
enclosingFunctionFlags & FunctionFlags.Async ? undefined : node.asteriskToken,
|
||||
node.asteriskToken,
|
||||
node.name,
|
||||
/*typeParameters*/ undefined,
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
/*type*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Async ?
|
||||
enclosingFunctionFlags & FunctionFlags.Generator ?
|
||||
transformAsyncGeneratorFunctionBody(node) :
|
||||
transformAsyncFunctionBody(node) :
|
||||
visitFunctionBody(node.body, visitor, context)
|
||||
getFunctionFlags(node) & FunctionFlags.Async
|
||||
? transformAsyncFunctionBody(node)
|
||||
: visitFunctionBody(node.body, visitor, context)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -361,25 +141,19 @@ namespace ts {
|
||||
* @param node The node to visit.
|
||||
*/
|
||||
function visitFunctionDeclaration(node: FunctionDeclaration): VisitResult<Statement> {
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(node);
|
||||
const updated = updateFunctionDeclaration(
|
||||
return updateFunctionDeclaration(
|
||||
node,
|
||||
/*decorators*/ undefined,
|
||||
visitNodes(node.modifiers, visitor, isModifier),
|
||||
enclosingFunctionFlags & FunctionFlags.Async ? undefined : node.asteriskToken,
|
||||
node.asteriskToken,
|
||||
node.name,
|
||||
/*typeParameters*/ undefined,
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
/*type*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Async ?
|
||||
enclosingFunctionFlags & FunctionFlags.Generator ?
|
||||
transformAsyncGeneratorFunctionBody(node) :
|
||||
transformAsyncFunctionBody(node) :
|
||||
visitFunctionBody(node.body, visitor, context)
|
||||
getFunctionFlags(node) & FunctionFlags.Async
|
||||
? transformAsyncFunctionBody(node)
|
||||
: visitFunctionBody(node.body, visitor, context)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -391,24 +165,18 @@ namespace ts {
|
||||
* @param node The node to visit.
|
||||
*/
|
||||
function visitFunctionExpression(node: FunctionExpression): Expression {
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(node);
|
||||
const updated = updateFunctionExpression(
|
||||
return updateFunctionExpression(
|
||||
node,
|
||||
visitNodes(node.modifiers, visitor, isModifier),
|
||||
enclosingFunctionFlags & FunctionFlags.Async ? undefined : node.asteriskToken,
|
||||
node.asteriskToken,
|
||||
node.name,
|
||||
/*typeParameters*/ undefined,
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
/*type*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Async ?
|
||||
enclosingFunctionFlags & FunctionFlags.Generator ?
|
||||
transformAsyncGeneratorFunctionBody(node) :
|
||||
transformAsyncFunctionBody(node) :
|
||||
visitFunctionBody(node.body, visitor, context)
|
||||
getFunctionFlags(node) & FunctionFlags.Async
|
||||
? transformAsyncFunctionBody(node)
|
||||
: visitFunctionBody(node.body, visitor, context)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -420,62 +188,16 @@ namespace ts {
|
||||
* @param node The node to visit.
|
||||
*/
|
||||
function visitArrowFunction(node: ArrowFunction) {
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(node);
|
||||
const updated = updateArrowFunction(
|
||||
return updateArrowFunction(
|
||||
node,
|
||||
visitNodes(node.modifiers, visitor, isModifier),
|
||||
/*typeParameters*/ undefined,
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
/*type*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Async ?
|
||||
transformAsyncFunctionBody(node) :
|
||||
visitFunctionBody(node.body, visitor, context)
|
||||
getFunctionFlags(node) & FunctionFlags.Async
|
||||
? transformAsyncFunctionBody(node)
|
||||
: visitFunctionBody(node.body, visitor, context)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
function transformAsyncGeneratorFunctionBody(node: MethodDeclaration | AccessorDeclaration | FunctionDeclaration | FunctionExpression): FunctionBody {
|
||||
resumeLexicalEnvironment();
|
||||
const statements: Statement[] = [];
|
||||
const statementOffset = addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
|
||||
statements.push(
|
||||
createReturn(
|
||||
createAsyncGeneratorHelper(
|
||||
context,
|
||||
createFunctionExpression(
|
||||
/*modifiers*/ undefined,
|
||||
createToken(SyntaxKind.AsteriskToken),
|
||||
node.name && getGeneratedNameForNode(node.name),
|
||||
/*typeParameters*/ undefined,
|
||||
/*parameters*/ [],
|
||||
/*type*/ undefined,
|
||||
updateBlock(
|
||||
node.body,
|
||||
visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
addRange(statements, endLexicalEnvironment());
|
||||
const block = updateBlock(node.body, statements);
|
||||
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
||||
// This step isn't needed if we eventually transform this to ES5.
|
||||
if (languageVersion >= ScriptTarget.ES2015) {
|
||||
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) {
|
||||
enableSubstitutionForAsyncMethodsWithSuper();
|
||||
addEmitHelper(block, advancedAsyncSuperHelper);
|
||||
}
|
||||
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuper) {
|
||||
enableSubstitutionForAsyncMethodsWithSuper();
|
||||
addEmitHelper(block, asyncSuperHelper);
|
||||
}
|
||||
}
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
function transformAsyncFunctionBody(node: MethodDeclaration | AccessorDeclaration | FunctionDeclaration | FunctionExpression): FunctionBody;
|
||||
@ -590,6 +312,44 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for node emit.
|
||||
*
|
||||
* @param node The node to emit.
|
||||
* @param emit A callback used to emit the node in the printer.
|
||||
*/
|
||||
function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void {
|
||||
// If we need to support substitutions for `super` in an async method,
|
||||
// we should track it here.
|
||||
if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && isSuperContainer(node)) {
|
||||
const superContainerFlags = resolver.getNodeCheckFlags(node) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding);
|
||||
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
||||
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
||||
enclosingSuperContainerFlags = superContainerFlags;
|
||||
previousOnEmitNode(emitContext, node, emitCallback);
|
||||
enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags;
|
||||
return;
|
||||
}
|
||||
}
|
||||
previousOnEmitNode(emitContext, node, emitCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks node substitutions.
|
||||
*
|
||||
* @param node The node to substitute.
|
||||
* @param isExpression A value indicating whether the node is to be used in an expression
|
||||
* position.
|
||||
*/
|
||||
function onSubstituteNode(emitContext: EmitContext, node: Node) {
|
||||
node = previousOnSubstituteNode(emitContext, node);
|
||||
if (emitContext === EmitContext.Expression && enclosingSuperContainerFlags) {
|
||||
return substituteExpression(<Expression>node);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function substituteExpression(node: Expression) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
@ -597,62 +357,45 @@ namespace ts {
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return substituteElementAccessExpression(<ElementAccessExpression>node);
|
||||
case SyntaxKind.CallExpression:
|
||||
if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper) {
|
||||
return substituteCallExpression(<CallExpression>node);
|
||||
}
|
||||
break;
|
||||
return substituteCallExpression(<CallExpression>node);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function substitutePropertyAccessExpression(node: PropertyAccessExpression) {
|
||||
if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
const flags = getSuperContainerAsyncMethodFlags();
|
||||
if (flags) {
|
||||
return createSuperAccessInAsyncMethod(
|
||||
createLiteral(node.name.text),
|
||||
flags,
|
||||
node
|
||||
);
|
||||
}
|
||||
if (node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
return createSuperAccessInAsyncMethod(
|
||||
createLiteral(node.name.text),
|
||||
node
|
||||
);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function substituteElementAccessExpression(node: ElementAccessExpression) {
|
||||
if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
const flags = getSuperContainerAsyncMethodFlags();
|
||||
if (flags) {
|
||||
return createSuperAccessInAsyncMethod(
|
||||
node.argumentExpression,
|
||||
flags,
|
||||
node
|
||||
);
|
||||
}
|
||||
if (node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
return createSuperAccessInAsyncMethod(
|
||||
node.argumentExpression,
|
||||
node
|
||||
);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function substituteCallExpression(node: CallExpression): Expression {
|
||||
const expression = node.expression;
|
||||
if (isSuperProperty(expression)) {
|
||||
const flags = getSuperContainerAsyncMethodFlags();
|
||||
if (flags) {
|
||||
const argumentExpression = isPropertyAccessExpression(expression)
|
||||
? substitutePropertyAccessExpression(expression)
|
||||
: substituteElementAccessExpression(expression);
|
||||
return createCall(
|
||||
createPropertyAccess(argumentExpression, "call"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
createThis(),
|
||||
...node.arguments
|
||||
]
|
||||
);
|
||||
}
|
||||
const argumentExpression = isPropertyAccessExpression(expression)
|
||||
? substitutePropertyAccessExpression(expression)
|
||||
: substituteElementAccessExpression(expression);
|
||||
return createCall(
|
||||
createPropertyAccess(argumentExpression, "call"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
createThis(),
|
||||
...node.arguments
|
||||
]
|
||||
);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
@ -666,44 +409,8 @@ namespace ts {
|
||||
|| kind === SyntaxKind.SetAccessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for node emit.
|
||||
*
|
||||
* @param node The node to emit.
|
||||
* @param emit A callback used to emit the node in the printer.
|
||||
*/
|
||||
function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void {
|
||||
// If we need to support substitutions for `super` in an async method,
|
||||
// we should track it here.
|
||||
if (enabledSubstitutions & ES2017SubstitutionFlags.AsyncMethodsWithSuper && isSuperContainer(node)) {
|
||||
const savedCurrentSuperContainer = currentSuperContainer;
|
||||
currentSuperContainer = node;
|
||||
previousOnEmitNode(emitContext, node, emitCallback);
|
||||
currentSuperContainer = savedCurrentSuperContainer;
|
||||
}
|
||||
else {
|
||||
previousOnEmitNode(emitContext, node, emitCallback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks node substitutions.
|
||||
*
|
||||
* @param node The node to substitute.
|
||||
* @param isExpression A value indicating whether the node is to be used in an expression
|
||||
* position.
|
||||
*/
|
||||
function onSubstituteNode(emitContext: EmitContext, node: Node) {
|
||||
node = previousOnSubstituteNode(emitContext, node);
|
||||
if (emitContext === EmitContext.Expression) {
|
||||
return substituteExpression(<Expression>node);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function createSuperAccessInAsyncMethod(argumentExpression: Expression, flags: NodeCheckFlags, location: TextRange): LeftHandSideExpression {
|
||||
if (flags & NodeCheckFlags.AsyncMethodWithSuperBinding) {
|
||||
function createSuperAccessInAsyncMethod(argumentExpression: Expression, location: TextRange): LeftHandSideExpression {
|
||||
if (enclosingSuperContainerFlags & NodeCheckFlags.AsyncMethodWithSuperBinding) {
|
||||
return createPropertyAccess(
|
||||
createCall(
|
||||
createIdentifier("_super"),
|
||||
@ -723,11 +430,6 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getSuperContainerAsyncMethodFlags() {
|
||||
return currentSuperContainer !== undefined
|
||||
&& resolver.getNodeCheckFlags(currentSuperContainer) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding);
|
||||
}
|
||||
}
|
||||
|
||||
const awaiterHelper: EmitHelper = {
|
||||
@ -773,100 +475,7 @@ namespace ts {
|
||||
);
|
||||
}
|
||||
|
||||
const asyncGeneratorHelper: EmitHelper = {
|
||||
name: "typescript:asyncGenerator",
|
||||
scoped: false,
|
||||
text: `
|
||||
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
||||
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
|
||||
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
|
||||
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
|
||||
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
|
||||
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { c = void 0, f(v), next(); }
|
||||
};`
|
||||
};
|
||||
|
||||
function createAsyncGeneratorHelper(context: TransformationContext, generatorFunc: FunctionExpression) {
|
||||
context.requestEmitHelper(asyncGeneratorHelper);
|
||||
|
||||
// Mark this node as originally an async function
|
||||
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= EmitFlags.AsyncFunctionBody;
|
||||
|
||||
return createCall(
|
||||
getHelperName("__asyncGenerator"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
createThis(),
|
||||
createIdentifier("arguments"),
|
||||
generatorFunc
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
const asyncValues: EmitHelper = {
|
||||
name: "typescript:asyncValues",
|
||||
scoped: false,
|
||||
text: `
|
||||
var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; };
|
||||
`
|
||||
};
|
||||
|
||||
function createAsyncValuesHelper(context: TransformationContext, expression: Expression, location?: TextRange) {
|
||||
context.requestEmitHelper(asyncValues);
|
||||
return createCall(
|
||||
getHelperName("__asyncValues"),
|
||||
/*typeArguments*/ undefined,
|
||||
[expression],
|
||||
location
|
||||
);
|
||||
}
|
||||
|
||||
const asyncDelegator: EmitHelper = {
|
||||
name: "typescript:asyncDelegator",
|
||||
scoped: false,
|
||||
text: `
|
||||
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
||||
var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) };
|
||||
return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; }
|
||||
};
|
||||
`
|
||||
};
|
||||
|
||||
function createAsyncDelegatorHelper(context: TransformationContext, expression: Expression, location?: TextRange) {
|
||||
context.requestEmitHelper(asyncDelegator);
|
||||
return createCall(
|
||||
getHelperName("__asyncDelegator"),
|
||||
/*typeArguments*/ undefined,
|
||||
[expression],
|
||||
location
|
||||
);
|
||||
}
|
||||
|
||||
const asyncStep: EmitHelper = {
|
||||
name: "typescript:asyncStep",
|
||||
scoped: false,
|
||||
text: `
|
||||
var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); };
|
||||
`
|
||||
};
|
||||
|
||||
function createAsyncStepHelper(context: TransformationContext, iteratorRecord: Expression, location?: TextRange) {
|
||||
context.requestEmitHelper(asyncStep);
|
||||
return createCall(
|
||||
getHelperName("__asyncStep"),
|
||||
/*typeArguments*/ undefined,
|
||||
[iteratorRecord],
|
||||
location
|
||||
);
|
||||
}
|
||||
|
||||
const asyncSuperHelper: EmitHelper = {
|
||||
export const asyncSuperHelper: EmitHelper = {
|
||||
name: "typescript:async-super",
|
||||
scoped: true,
|
||||
text: `
|
||||
@ -874,7 +483,7 @@ namespace ts {
|
||||
`
|
||||
};
|
||||
|
||||
const advancedAsyncSuperHelper: EmitHelper = {
|
||||
export const advancedAsyncSuperHelper: EmitHelper = {
|
||||
name: "typescript:advanced-async-super",
|
||||
scoped: true,
|
||||
text: `
|
||||
|
||||
@ -1,13 +1,35 @@
|
||||
/// <reference path="../factory.ts" />
|
||||
/// <reference path="../visitor.ts" />
|
||||
/// <reference path="es2017.ts" />
|
||||
|
||||
/*@internal*/
|
||||
namespace ts {
|
||||
const enum ESNextSubstitutionFlags {
|
||||
/** Enables substitutions for async methods with `super` calls. */
|
||||
AsyncMethodsWithSuper = 1 << 0
|
||||
}
|
||||
|
||||
export function transformESNext(context: TransformationContext) {
|
||||
const {
|
||||
resumeLexicalEnvironment,
|
||||
endLexicalEnvironment
|
||||
endLexicalEnvironment,
|
||||
hoistVariableDeclaration
|
||||
} = context;
|
||||
|
||||
const resolver = context.getEmitResolver();
|
||||
const compilerOptions = context.getCompilerOptions();
|
||||
const languageVersion = getEmitScriptTarget(compilerOptions);
|
||||
|
||||
const previousOnEmitNode = context.onEmitNode;
|
||||
context.onEmitNode = onEmitNode;
|
||||
|
||||
const previousOnSubstituteNode = context.onSubstituteNode;
|
||||
context.onSubstituteNode = onSubstituteNode;
|
||||
|
||||
let enabledSubstitutions: ESNextSubstitutionFlags;
|
||||
let enclosingFunctionFlags: FunctionFlags;
|
||||
let enclosingSuperContainerFlags: NodeCheckFlags = 0;
|
||||
|
||||
return transformSourceFile;
|
||||
|
||||
function transformSourceFile(node: SourceFile) {
|
||||
@ -28,12 +50,25 @@ namespace ts {
|
||||
return visitorWorker(node, /*noDestructuringValue*/ true);
|
||||
}
|
||||
|
||||
function visitorNoAsyncModifier(node: Node): VisitResult<Node> {
|
||||
if (node.kind === SyntaxKind.AsyncKeyword) {
|
||||
return undefined;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function visitorWorker(node: Node, noDestructuringValue: boolean): VisitResult<Node> {
|
||||
if ((node.transformFlags & TransformFlags.ContainsESNext) === 0) {
|
||||
return node;
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.AwaitExpression:
|
||||
return visitAwaitExpression(node as AwaitExpression);
|
||||
case SyntaxKind.YieldExpression:
|
||||
return visitYieldExpression(node as YieldExpression);
|
||||
case SyntaxKind.LabeledStatement:
|
||||
return visitLabeledStatement(node as LabeledStatement);
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return visitObjectLiteralExpression(node as ObjectLiteralExpression);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
@ -41,7 +76,7 @@ namespace ts {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return visitVariableDeclaration(node as VariableDeclaration);
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return visitForOfStatement(node as ForOfStatement);
|
||||
return visitForOfStatement(node as ForOfStatement, /*outermostLabeledStatement*/ undefined);
|
||||
case SyntaxKind.ForStatement:
|
||||
return visitForStatement(node as ForStatement);
|
||||
case SyntaxKind.VoidExpression:
|
||||
@ -71,6 +106,49 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function visitAwaitExpression(node: AwaitExpression) {
|
||||
if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) {
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
return setOriginalNode(
|
||||
createYield(
|
||||
/*asteriskToken*/ undefined,
|
||||
createArrayLiteral([createLiteral("await"), expression]),
|
||||
/*location*/ node
|
||||
),
|
||||
node
|
||||
);
|
||||
}
|
||||
return visitEachChild(node, visitor, context);
|
||||
}
|
||||
|
||||
function visitYieldExpression(node: YieldExpression) {
|
||||
if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) {
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
return updateYield(
|
||||
node,
|
||||
node.asteriskToken
|
||||
? createAsyncDelegatorHelper(context, expression, expression)
|
||||
: createArrayLiteral(
|
||||
expression
|
||||
? [createLiteral("yield"), expression]
|
||||
: [createLiteral("yield")]
|
||||
)
|
||||
);
|
||||
}
|
||||
return visitEachChild(node, visitor, context);
|
||||
}
|
||||
|
||||
function visitLabeledStatement(node: LabeledStatement) {
|
||||
if (enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator) {
|
||||
const statement = unwrapInnermostStatmentOfLabel(node);
|
||||
if (statement.kind === SyntaxKind.ForOfStatement && (<ForOfStatement>statement).awaitModifier) {
|
||||
return visitForOfStatement(<ForOfStatement>statement, node);
|
||||
}
|
||||
return restoreEnclosingLabel(visitEachChild(node, visitor, context), node);
|
||||
}
|
||||
return visitEachChild(node, visitor, context);
|
||||
}
|
||||
|
||||
function chunkObjectLiteralElements(elements: ObjectLiteralElement[]): Expression[] {
|
||||
let chunkObject: (ShorthandPropertyAssignment | PropertyAssignment)[];
|
||||
const objects: Expression[] = [];
|
||||
@ -189,49 +267,30 @@ namespace ts {
|
||||
*
|
||||
* @param node A ForOfStatement.
|
||||
*/
|
||||
function visitForOfStatement(node: ForOfStatement): VisitResult<Statement> {
|
||||
let leadingStatements: Statement[];
|
||||
let temp: Identifier;
|
||||
const initializer = skipParentheses(node.initializer);
|
||||
if (initializer.transformFlags & TransformFlags.ContainsObjectRest) {
|
||||
if (isVariableDeclarationList(initializer)) {
|
||||
temp = createTempVariable(/*recordTempVariable*/ undefined);
|
||||
const firstDeclaration = firstOrUndefined(initializer.declarations);
|
||||
const declarations = flattenDestructuringBinding(
|
||||
firstDeclaration,
|
||||
visitor,
|
||||
context,
|
||||
FlattenLevel.ObjectRest,
|
||||
temp,
|
||||
/*doNotRecordTempVariablesInLine*/ false,
|
||||
/*skipInitializer*/ true,
|
||||
);
|
||||
if (some(declarations)) {
|
||||
const statement = createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
updateVariableDeclarationList(initializer, declarations),
|
||||
/*location*/ initializer
|
||||
);
|
||||
leadingStatements = append(leadingStatements, statement);
|
||||
}
|
||||
}
|
||||
else if (isAssignmentPattern(initializer)) {
|
||||
temp = createTempVariable(/*recordTempVariable*/ undefined);
|
||||
const expression = flattenDestructuringAssignment(
|
||||
aggregateTransformFlags(createAssignment(initializer, temp, /*location*/ node.initializer)),
|
||||
visitor,
|
||||
context,
|
||||
FlattenLevel.ObjectRest
|
||||
);
|
||||
leadingStatements = append(leadingStatements, createStatement(expression, /*location*/ node.initializer));
|
||||
}
|
||||
function visitForOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement): VisitResult<Statement> {
|
||||
if (node.initializer.transformFlags & TransformFlags.ContainsObjectRest) {
|
||||
node = transformForOfStatementWithObjectRest(node);
|
||||
}
|
||||
if (temp) {
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
const statement = visitNode(node.statement, visitor, isStatement);
|
||||
const block = isBlock(statement)
|
||||
? updateBlock(statement, createNodeArray(concatenate(leadingStatements, statement.statements), statement.statements))
|
||||
: createBlock(append(leadingStatements, statement), statement, /*multiLine*/ true);
|
||||
if (node.awaitModifier) {
|
||||
return transformForAwaitOfStatement(node, outermostLabeledStatement);
|
||||
}
|
||||
else {
|
||||
return restoreEnclosingLabel(visitEachChild(node, visitor, context), outermostLabeledStatement);
|
||||
}
|
||||
}
|
||||
|
||||
function transformForOfStatementWithObjectRest(node: ForOfStatement) {
|
||||
const initializerWithoutParens = skipParentheses(node.initializer) as ForInitializer;
|
||||
if (isVariableDeclarationList(initializerWithoutParens) || isAssignmentPattern(initializerWithoutParens)) {
|
||||
let bodyLocation: TextRange;
|
||||
let statementsLocation: TextRange;
|
||||
const temp = createTempVariable(/*recordTempVariable*/ undefined);
|
||||
const statements: Statement[] = [createForOfBindingStatement(initializerWithoutParens, temp)];
|
||||
if (isBlock(node.statement)) {
|
||||
addRange(statements, node.statement.statements);
|
||||
bodyLocation = node.statement;
|
||||
statementsLocation = node.statement.statements;
|
||||
}
|
||||
return updateForOf(
|
||||
node,
|
||||
node.awaitModifier,
|
||||
@ -242,11 +301,174 @@ namespace ts {
|
||||
node.initializer,
|
||||
NodeFlags.Let
|
||||
),
|
||||
expression,
|
||||
block
|
||||
node.expression,
|
||||
createBlock(
|
||||
createNodeArray(statements, statementsLocation),
|
||||
bodyLocation,
|
||||
/*multiLine*/ true
|
||||
)
|
||||
);
|
||||
}
|
||||
return visitEachChild(node, visitor, context);
|
||||
return node;
|
||||
}
|
||||
|
||||
function transformForAwaitOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement) {
|
||||
const iteratorRecord = isIdentifier(node.expression)
|
||||
? getGeneratedNameForNode(node.expression)
|
||||
: createUniqueName("iterator");
|
||||
const expression = visitNode(node.expression, visitor, isExpression);
|
||||
const binding = createForOfBindingStatement(
|
||||
node.initializer,
|
||||
createPropertyAccess(
|
||||
createPropertyAccess(iteratorRecord, "result"),
|
||||
"value"
|
||||
)
|
||||
);
|
||||
|
||||
let bodyLocation: TextRange;
|
||||
let statementsLocation: TextRange;
|
||||
const statements: Statement[] = [visitNode(binding, visitor, isStatement)];
|
||||
const statement = visitNode(node.statement, visitor, isStatement);
|
||||
if (isBlock(statement)) {
|
||||
addRange(statements, statement.statements);
|
||||
bodyLocation = statement;
|
||||
statementsLocation = statement.statements;
|
||||
}
|
||||
else {
|
||||
statements.push(statement);
|
||||
}
|
||||
|
||||
const step = createAsyncStepHelper(
|
||||
context,
|
||||
iteratorRecord,
|
||||
node.initializer
|
||||
);
|
||||
|
||||
const forStatement = setEmitFlags(
|
||||
createFor(
|
||||
createVariableDeclarationList(
|
||||
[
|
||||
createVariableDeclaration(
|
||||
iteratorRecord,
|
||||
/*type*/ undefined,
|
||||
createObjectLiteral(
|
||||
[
|
||||
createPropertyAssignment(
|
||||
"iterator",
|
||||
createAsyncValuesHelper(
|
||||
context,
|
||||
expression,
|
||||
node.expression
|
||||
),
|
||||
node.expression
|
||||
)
|
||||
],
|
||||
node.expression
|
||||
),
|
||||
node.expression
|
||||
)
|
||||
],
|
||||
node.expression
|
||||
),
|
||||
/*condition*/ createYield(
|
||||
/*asteriskToken*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Generator ?
|
||||
createArrayLiteral([createLiteral("await"), step]) :
|
||||
step,
|
||||
node.initializer
|
||||
),
|
||||
/*incrementor*/ undefined,
|
||||
setEmitFlags(
|
||||
createBlock(
|
||||
createNodeArray(statements, statementsLocation),
|
||||
bodyLocation,
|
||||
/*multiLine*/ true
|
||||
),
|
||||
EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps
|
||||
),
|
||||
/*location*/ node
|
||||
),
|
||||
EmitFlags.NoTokenTrailingSourceMaps
|
||||
);
|
||||
|
||||
return closeAsyncIterator(
|
||||
restoreEnclosingLabel(
|
||||
forStatement,
|
||||
outermostLabeledStatement
|
||||
),
|
||||
iteratorRecord
|
||||
);
|
||||
}
|
||||
|
||||
function closeAsyncIterator(statement: Statement, iteratorRecord: Expression) {
|
||||
const errorRecord = createUniqueName("e");
|
||||
hoistVariableDeclaration(errorRecord);
|
||||
const catchVariable = getGeneratedNameForNode(errorRecord);
|
||||
const close = createCloseHelper(
|
||||
context,
|
||||
iteratorRecord
|
||||
);
|
||||
return createTry(
|
||||
createBlock([
|
||||
statement
|
||||
]),
|
||||
createCatchClause(catchVariable,
|
||||
setEmitFlags(
|
||||
createBlock([
|
||||
createStatement(
|
||||
createAssignment(
|
||||
errorRecord,
|
||||
createObjectLiteral([
|
||||
createPropertyAssignment(
|
||||
"error",
|
||||
catchVariable
|
||||
)
|
||||
])
|
||||
)
|
||||
)
|
||||
]),
|
||||
EmitFlags.SingleLine
|
||||
)
|
||||
),
|
||||
createBlock([
|
||||
setEmitFlags(
|
||||
createTry(
|
||||
setEmitFlags(
|
||||
createBlock([
|
||||
createStatement(
|
||||
createYield(
|
||||
/*asteriskToken*/ undefined,
|
||||
enclosingFunctionFlags & FunctionFlags.Generator ?
|
||||
createArrayLiteral([createLiteral("await"), close]) :
|
||||
close
|
||||
)
|
||||
)
|
||||
]),
|
||||
EmitFlags.SingleLine
|
||||
),
|
||||
undefined,
|
||||
setEmitFlags(
|
||||
createBlock([
|
||||
setEmitFlags(
|
||||
createIf(
|
||||
errorRecord,
|
||||
createThrow(
|
||||
createPropertyAccess(
|
||||
errorRecord,
|
||||
"error"
|
||||
)
|
||||
)
|
||||
),
|
||||
EmitFlags.SingleLine
|
||||
)
|
||||
]),
|
||||
EmitFlags.SingleLine
|
||||
)
|
||||
),
|
||||
EmitFlags.SingleLine
|
||||
)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
function visitParameter(node: ParameterDeclaration): ParameterDeclaration {
|
||||
@ -267,17 +489,23 @@ namespace ts {
|
||||
}
|
||||
|
||||
function visitConstructorDeclaration(node: ConstructorDeclaration) {
|
||||
return updateConstructor(
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = FunctionFlags.Normal;
|
||||
const updated = updateConstructor(
|
||||
node,
|
||||
/*decorators*/ undefined,
|
||||
node.modifiers,
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
transformFunctionBody(node)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
function visitGetAccessorDeclaration(node: GetAccessorDeclaration) {
|
||||
return updateGetAccessor(
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = FunctionFlags.Normal;
|
||||
const updated = updateGetAccessor(
|
||||
node,
|
||||
/*decorators*/ undefined,
|
||||
node.modifiers,
|
||||
@ -286,10 +514,14 @@ namespace ts {
|
||||
/*type*/ undefined,
|
||||
transformFunctionBody(node)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
function visitSetAccessorDeclaration(node: SetAccessorDeclaration) {
|
||||
return updateSetAccessor(
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = FunctionFlags.Normal;
|
||||
const updated = updateSetAccessor(
|
||||
node,
|
||||
/*decorators*/ undefined,
|
||||
node.modifiers,
|
||||
@ -297,38 +529,62 @@ namespace ts {
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
transformFunctionBody(node)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
function visitMethodDeclaration(node: MethodDeclaration) {
|
||||
return updateMethod(
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(node);
|
||||
const updated = updateMethod(
|
||||
node,
|
||||
/*decorators*/ undefined,
|
||||
node.modifiers,
|
||||
node.asteriskToken,
|
||||
enclosingFunctionFlags & FunctionFlags.Generator
|
||||
? visitNodes(node.modifiers, visitorNoAsyncModifier, isModifier)
|
||||
: node.modifiers,
|
||||
enclosingFunctionFlags & FunctionFlags.Async
|
||||
? undefined
|
||||
: node.asteriskToken,
|
||||
visitNode(node.name, visitor, isPropertyName),
|
||||
/*typeParameters*/ undefined,
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
/*type*/ undefined,
|
||||
transformFunctionBody(node)
|
||||
enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator
|
||||
? transformAsyncGeneratorFunctionBody(node)
|
||||
: transformFunctionBody(node)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
function visitFunctionDeclaration(node: FunctionDeclaration) {
|
||||
return updateFunctionDeclaration(
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(node);
|
||||
const updated = updateFunctionDeclaration(
|
||||
node,
|
||||
/*decorators*/ undefined,
|
||||
node.modifiers,
|
||||
node.asteriskToken,
|
||||
enclosingFunctionFlags & FunctionFlags.Generator
|
||||
? visitNodes(node.modifiers, visitorNoAsyncModifier, isModifier)
|
||||
: node.modifiers,
|
||||
enclosingFunctionFlags & FunctionFlags.Async
|
||||
? undefined
|
||||
: node.asteriskToken,
|
||||
node.name,
|
||||
/*typeParameters*/ undefined,
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
/*type*/ undefined,
|
||||
transformFunctionBody(node)
|
||||
enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator
|
||||
? transformAsyncGeneratorFunctionBody(node)
|
||||
: transformFunctionBody(node)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
function visitArrowFunction(node: ArrowFunction) {
|
||||
return updateArrowFunction(
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(node);
|
||||
const updated = updateArrowFunction(
|
||||
node,
|
||||
node.modifiers,
|
||||
/*typeParameters*/ undefined,
|
||||
@ -336,26 +592,92 @@ namespace ts {
|
||||
/*type*/ undefined,
|
||||
transformFunctionBody(node)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
function visitFunctionExpression(node: FunctionExpression) {
|
||||
return updateFunctionExpression(
|
||||
const savedEnclosingFunctionFlags = enclosingFunctionFlags;
|
||||
enclosingFunctionFlags = getFunctionFlags(node);
|
||||
const updated = updateFunctionExpression(
|
||||
node,
|
||||
node.modifiers,
|
||||
node.asteriskToken,
|
||||
enclosingFunctionFlags & FunctionFlags.Generator
|
||||
? visitNodes(node.modifiers, visitorNoAsyncModifier, isModifier)
|
||||
: node.modifiers,
|
||||
enclosingFunctionFlags & FunctionFlags.Async
|
||||
? undefined
|
||||
: node.asteriskToken,
|
||||
node.name,
|
||||
/*typeParameters*/ undefined,
|
||||
visitParameterList(node.parameters, visitor, context),
|
||||
/*type*/ undefined,
|
||||
transformFunctionBody(node)
|
||||
enclosingFunctionFlags & FunctionFlags.Async && enclosingFunctionFlags & FunctionFlags.Generator
|
||||
? transformAsyncGeneratorFunctionBody(node)
|
||||
: transformFunctionBody(node)
|
||||
);
|
||||
enclosingFunctionFlags = savedEnclosingFunctionFlags;
|
||||
return updated;
|
||||
}
|
||||
|
||||
function transformAsyncGeneratorFunctionBody(node: MethodDeclaration | AccessorDeclaration | FunctionDeclaration | FunctionExpression): FunctionBody {
|
||||
resumeLexicalEnvironment();
|
||||
const statements: Statement[] = [];
|
||||
const statementOffset = addPrologueDirectives(statements, node.body.statements, /*ensureUseStrict*/ false, visitor);
|
||||
appendObjectRestAssignmentsIfNeeded(statements, node);
|
||||
|
||||
statements.push(
|
||||
createReturn(
|
||||
createAsyncGeneratorHelper(
|
||||
context,
|
||||
createFunctionExpression(
|
||||
/*modifiers*/ undefined,
|
||||
createToken(SyntaxKind.AsteriskToken),
|
||||
node.name && getGeneratedNameForNode(node.name),
|
||||
/*typeParameters*/ undefined,
|
||||
/*parameters*/ [],
|
||||
/*type*/ undefined,
|
||||
updateBlock(
|
||||
node.body,
|
||||
visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
addRange(statements, endLexicalEnvironment());
|
||||
const block = updateBlock(node.body, statements);
|
||||
|
||||
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
|
||||
// This step isn't needed if we eventually transform this to ES5.
|
||||
if (languageVersion >= ScriptTarget.ES2015) {
|
||||
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) {
|
||||
enableSubstitutionForAsyncMethodsWithSuper();
|
||||
addEmitHelper(block, advancedAsyncSuperHelper);
|
||||
}
|
||||
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuper) {
|
||||
enableSubstitutionForAsyncMethodsWithSuper();
|
||||
addEmitHelper(block, asyncSuperHelper);
|
||||
}
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
||||
function transformFunctionBody(node: FunctionDeclaration | FunctionExpression | ConstructorDeclaration | MethodDeclaration | AccessorDeclaration): FunctionBody;
|
||||
function transformFunctionBody(node: ArrowFunction): ConciseBody;
|
||||
function transformFunctionBody(node: FunctionLikeDeclaration): ConciseBody {
|
||||
resumeLexicalEnvironment();
|
||||
let leadingStatements: Statement[];
|
||||
const leadingStatements = appendObjectRestAssignmentsIfNeeded(/*statements*/ undefined, node);
|
||||
const body = visitNode(node.body, visitor, isConciseBody);
|
||||
const trailingStatements = endLexicalEnvironment();
|
||||
if (some(leadingStatements) || some(trailingStatements)) {
|
||||
const block = convertToFunctionBody(body, /*multiLine*/ true);
|
||||
return updateBlock(block, createNodeArray(concatenate(concatenate(leadingStatements, block.statements), trailingStatements), block.statements));
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
function appendObjectRestAssignmentsIfNeeded(statements: Statement[], node: FunctionLikeDeclaration): Statement[] {
|
||||
for (const parameter of node.parameters) {
|
||||
if (parameter.transformFlags & TransformFlags.ContainsObjectRest) {
|
||||
const temp = getGeneratedNameForNode(parameter);
|
||||
@ -376,17 +698,149 @@ namespace ts {
|
||||
)
|
||||
);
|
||||
setEmitFlags(statement, EmitFlags.CustomPrologue);
|
||||
leadingStatements = append(leadingStatements, statement);
|
||||
statements = append(statements, statement);
|
||||
}
|
||||
}
|
||||
}
|
||||
const body = visitNode(node.body, visitor, isConciseBody);
|
||||
const trailingStatements = endLexicalEnvironment();
|
||||
if (some(leadingStatements) || some(trailingStatements)) {
|
||||
const block = convertToFunctionBody(body, /*multiLine*/ true);
|
||||
return updateBlock(block, createNodeArray(concatenate(concatenate(leadingStatements, block.statements), trailingStatements), block.statements));
|
||||
return statements;
|
||||
}
|
||||
|
||||
function enableSubstitutionForAsyncMethodsWithSuper() {
|
||||
if ((enabledSubstitutions & ESNextSubstitutionFlags.AsyncMethodsWithSuper) === 0) {
|
||||
enabledSubstitutions |= ESNextSubstitutionFlags.AsyncMethodsWithSuper;
|
||||
|
||||
// We need to enable substitutions for call, property access, and element access
|
||||
// if we need to rewrite super calls.
|
||||
context.enableSubstitution(SyntaxKind.CallExpression);
|
||||
context.enableSubstitution(SyntaxKind.PropertyAccessExpression);
|
||||
context.enableSubstitution(SyntaxKind.ElementAccessExpression);
|
||||
|
||||
// We need to be notified when entering and exiting declarations that bind super.
|
||||
context.enableEmitNotification(SyntaxKind.ClassDeclaration);
|
||||
context.enableEmitNotification(SyntaxKind.MethodDeclaration);
|
||||
context.enableEmitNotification(SyntaxKind.GetAccessor);
|
||||
context.enableEmitNotification(SyntaxKind.SetAccessor);
|
||||
context.enableEmitNotification(SyntaxKind.Constructor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for node emit.
|
||||
*
|
||||
* @param node The node to emit.
|
||||
* @param emit A callback used to emit the node in the printer.
|
||||
*/
|
||||
function onEmitNode(emitContext: EmitContext, node: Node, emitCallback: (emitContext: EmitContext, node: Node) => void): void {
|
||||
// If we need to support substitutions for `super` in an async method,
|
||||
// we should track it here.
|
||||
if (enabledSubstitutions & ESNextSubstitutionFlags.AsyncMethodsWithSuper && isSuperContainer(node)) {
|
||||
const superContainerFlags = resolver.getNodeCheckFlags(node) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding);
|
||||
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
||||
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
||||
enclosingSuperContainerFlags = superContainerFlags;
|
||||
previousOnEmitNode(emitContext, node, emitCallback);
|
||||
enclosingSuperContainerFlags = savedEnclosingSuperContainerFlags;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
previousOnEmitNode(emitContext, node, emitCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hooks node substitutions.
|
||||
*
|
||||
* @param node The node to substitute.
|
||||
* @param isExpression A value indicating whether the node is to be used in an expression
|
||||
* position.
|
||||
*/
|
||||
function onSubstituteNode(emitContext: EmitContext, node: Node) {
|
||||
node = previousOnSubstituteNode(emitContext, node);
|
||||
if (emitContext === EmitContext.Expression && enclosingSuperContainerFlags) {
|
||||
return substituteExpression(<Expression>node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function substituteExpression(node: Expression) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
return substitutePropertyAccessExpression(<PropertyAccessExpression>node);
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
return substituteElementAccessExpression(<ElementAccessExpression>node);
|
||||
case SyntaxKind.CallExpression:
|
||||
return substituteCallExpression(<CallExpression>node);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function substitutePropertyAccessExpression(node: PropertyAccessExpression) {
|
||||
if (node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
return createSuperAccessInAsyncMethod(
|
||||
createLiteral(node.name.text),
|
||||
node
|
||||
);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function substituteElementAccessExpression(node: ElementAccessExpression) {
|
||||
if (node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
return createSuperAccessInAsyncMethod(
|
||||
node.argumentExpression,
|
||||
node
|
||||
);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function substituteCallExpression(node: CallExpression): Expression {
|
||||
const expression = node.expression;
|
||||
if (isSuperProperty(expression)) {
|
||||
const argumentExpression = isPropertyAccessExpression(expression)
|
||||
? substitutePropertyAccessExpression(expression)
|
||||
: substituteElementAccessExpression(expression);
|
||||
return createCall(
|
||||
createPropertyAccess(argumentExpression, "call"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
createThis(),
|
||||
...node.arguments
|
||||
]
|
||||
);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
function isSuperContainer(node: Node) {
|
||||
const kind = node.kind;
|
||||
return kind === SyntaxKind.ClassDeclaration
|
||||
|| kind === SyntaxKind.Constructor
|
||||
|| kind === SyntaxKind.MethodDeclaration
|
||||
|| kind === SyntaxKind.GetAccessor
|
||||
|| kind === SyntaxKind.SetAccessor;
|
||||
}
|
||||
|
||||
function createSuperAccessInAsyncMethod(argumentExpression: Expression, location: TextRange): LeftHandSideExpression {
|
||||
if (enclosingSuperContainerFlags & NodeCheckFlags.AsyncMethodWithSuperBinding) {
|
||||
return createPropertyAccess(
|
||||
createCall(
|
||||
createIdentifier("_super"),
|
||||
/*typeArguments*/ undefined,
|
||||
[argumentExpression]
|
||||
),
|
||||
"value",
|
||||
location
|
||||
);
|
||||
}
|
||||
else {
|
||||
return createCall(
|
||||
createIdentifier("_super"),
|
||||
/*typeArguments*/ undefined,
|
||||
[argumentExpression],
|
||||
location
|
||||
);
|
||||
}
|
||||
return body;
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,4 +867,97 @@ namespace ts {
|
||||
attributesSegments
|
||||
);
|
||||
}
|
||||
|
||||
const asyncGeneratorHelper: EmitHelper = {
|
||||
name: "typescript:asyncGenerator",
|
||||
scoped: false,
|
||||
text: `
|
||||
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
||||
var g = generator.apply(thisArg, _arguments || []), q = [], c, i;
|
||||
return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { return function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]), next(); }); }; }
|
||||
function next() { if (!c && q.length) resume((c = q.shift())[0], c[1]); }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(c[3], e); } }
|
||||
function step(r) { r.done ? settle(c[2], r) : r.value[0] === "yield" ? settle(c[2], { value: r.value[1], done: false }) : Promise.resolve(r.value[1]).then(r.value[0] === "delegate" ? delegate : fulfill, reject); }
|
||||
function delegate(r) { step(r.done ? r : { value: ["yield", r.value], done: false }); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { c = void 0, f(v), next(); }
|
||||
};`
|
||||
};
|
||||
|
||||
function createAsyncGeneratorHelper(context: TransformationContext, generatorFunc: FunctionExpression) {
|
||||
context.requestEmitHelper(asyncGeneratorHelper);
|
||||
|
||||
// Mark this node as originally an async function
|
||||
(generatorFunc.emitNode || (generatorFunc.emitNode = {})).flags |= EmitFlags.AsyncFunctionBody;
|
||||
|
||||
return createCall(
|
||||
getHelperName("__asyncGenerator"),
|
||||
/*typeArguments*/ undefined,
|
||||
[
|
||||
createThis(),
|
||||
createIdentifier("arguments"),
|
||||
generatorFunc
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
const asyncValues: EmitHelper = {
|
||||
name: "typescript:asyncValues",
|
||||
scoped: false,
|
||||
text: `
|
||||
var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; };
|
||||
`
|
||||
};
|
||||
|
||||
function createAsyncValuesHelper(context: TransformationContext, expression: Expression, location?: TextRange) {
|
||||
context.requestEmitHelper(asyncValues);
|
||||
return createCall(
|
||||
getHelperName("__asyncValues"),
|
||||
/*typeArguments*/ undefined,
|
||||
[expression],
|
||||
location
|
||||
);
|
||||
}
|
||||
|
||||
const asyncDelegator: EmitHelper = {
|
||||
name: "typescript:asyncDelegator",
|
||||
scoped: false,
|
||||
text: `
|
||||
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
||||
var i = { next: verb("next"), "throw": verb("throw", function (e) { throw e; }), "return": verb("return", function (v) { return { value: v, done: true }; }) };
|
||||
return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; }
|
||||
};
|
||||
`
|
||||
};
|
||||
|
||||
function createAsyncDelegatorHelper(context: TransformationContext, expression: Expression, location?: TextRange) {
|
||||
context.requestEmitHelper(asyncDelegator);
|
||||
return createCall(
|
||||
getHelperName("__asyncDelegator"),
|
||||
/*typeArguments*/ undefined,
|
||||
[expression],
|
||||
location
|
||||
);
|
||||
}
|
||||
|
||||
const asyncStep: EmitHelper = {
|
||||
name: "typescript:asyncStep",
|
||||
scoped: false,
|
||||
text: `
|
||||
var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); };
|
||||
`
|
||||
};
|
||||
|
||||
function createAsyncStepHelper(context: TransformationContext, iteratorRecord: Expression, location?: TextRange) {
|
||||
context.requestEmitHelper(asyncStep);
|
||||
return createCall(
|
||||
getHelperName("__asyncStep"),
|
||||
/*typeArguments*/ undefined,
|
||||
[iteratorRecord],
|
||||
location
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5,invalidOption", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.asynciterable'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
@ -263,7 +263,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.asynciterable'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
@ -283,7 +283,7 @@ namespace ts {
|
||||
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
|
||||
{
|
||||
errors: [{
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.asynciterable'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'",
|
||||
category: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: ts.Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ namespace ts {
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.asynciterable'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
@ -264,7 +264,7 @@ namespace ts {
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.asynciterable'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
@ -295,7 +295,7 @@ namespace ts {
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.asynciterable'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
@ -326,7 +326,7 @@ namespace ts {
|
||||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.asynciterable'",
|
||||
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'esnext.asynciterable'",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
|
||||
3
src/lib/es2017.d.ts
vendored
3
src/lib/es2017.d.ts
vendored
@ -1,5 +1,4 @@
|
||||
/// <reference path="lib.es2016.d.ts" />
|
||||
/// <reference path="lib.es2017.object.d.ts" />
|
||||
/// <reference path="lib.es2017.sharedmemory.d.ts" />
|
||||
/// <reference path="lib.es2017.string.d.ts" />
|
||||
/// <reference path="lib.es2017.asynciterable.d.ts" />
|
||||
/// <reference path="lib.es2017.string.d.ts" />
|
||||
2
src/lib/esnext.d.ts
vendored
2
src/lib/esnext.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
/// <reference path="lib.es2017.d.ts" />
|
||||
/// <reference path="lib.es2017.asynciterable.d.ts" />
|
||||
/// <reference path="lib.esnext.asynciterable.d.ts" />
|
||||
|
||||
@ -1,38 +1,38 @@
|
||||
//// [asyncAwaitWithCapturedBlockScopeVar.ts]
|
||||
async function fn1() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
}
|
||||
}
|
||||
|
||||
async function fn2() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn3() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn4(): Promise<number> {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
async function fn1() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
}
|
||||
}
|
||||
|
||||
async function fn2() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn3() {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
async function fn4(): Promise<number> {
|
||||
let ar = [];
|
||||
for (let i = 0; i < 1; i++) {
|
||||
await 1;
|
||||
ar.push(() => i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [asyncAwaitWithCapturedBlockScopeVar.js]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/emitter/es2017/asyncGenerators/emitter.asyncGenerators.classMethods.es2017.ts] ////
|
||||
//// [tests/cases/conformance/emitter/esnext/asyncGenerators/emitter.asyncGenerators.classMethods.esnext.ts] ////
|
||||
|
||||
//// [C1.ts]
|
||||
class C1 {
|
||||
@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C1.ts ===
|
||||
class C1 {
|
||||
>C1 : Symbol(C1, Decl(C1.ts, 0, 0))
|
||||
|
||||
@ -6,7 +6,7 @@ class C1 {
|
||||
>f : Symbol(C1.f, Decl(C1.ts, 0, 10))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C2.ts ===
|
||||
class C2 {
|
||||
>C2 : Symbol(C2, Decl(C2.ts, 0, 0))
|
||||
|
||||
@ -17,7 +17,7 @@ class C2 {
|
||||
>x : Symbol(x, Decl(C2.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C3.ts ===
|
||||
class C3 {
|
||||
>C3 : Symbol(C3, Decl(C3.ts, 0, 0))
|
||||
|
||||
@ -28,7 +28,7 @@ class C3 {
|
||||
>x : Symbol(x, Decl(C3.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C4.ts ===
|
||||
class C4 {
|
||||
>C4 : Symbol(C4, Decl(C4.ts, 0, 0))
|
||||
|
||||
@ -39,7 +39,7 @@ class C4 {
|
||||
>x : Symbol(x, Decl(C4.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C5.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C5.ts ===
|
||||
class C5 {
|
||||
>C5 : Symbol(C5, Decl(C5.ts, 0, 0))
|
||||
|
||||
@ -50,7 +50,7 @@ class C5 {
|
||||
>x : Symbol(x, Decl(C5.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C6.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C6.ts ===
|
||||
class C6 {
|
||||
>C6 : Symbol(C6, Decl(C6.ts, 0, 0))
|
||||
|
||||
@ -61,7 +61,7 @@ class C6 {
|
||||
>x : Symbol(x, Decl(C6.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C7.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C7.ts ===
|
||||
class C7 {
|
||||
>C7 : Symbol(C7, Decl(C7.ts, 0, 0))
|
||||
|
||||
@ -71,7 +71,7 @@ class C7 {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C8.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C8.ts ===
|
||||
class C8 {
|
||||
>C8 : Symbol(C8, Decl(C8.ts, 0, 0))
|
||||
|
||||
@ -87,7 +87,7 @@ class C8 {
|
||||
>g : Symbol(C8.g, Decl(C8.ts, 0, 10))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C9.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C9.ts ===
|
||||
class B9 {
|
||||
>B9 : Symbol(B9, Decl(C9.ts, 0, 0))
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C1.ts ===
|
||||
class C1 {
|
||||
>C1 : C1
|
||||
|
||||
@ -6,7 +6,7 @@ class C1 {
|
||||
>f : () => AsyncIterableIterator<any>
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C2.ts ===
|
||||
class C2 {
|
||||
>C2 : C2
|
||||
|
||||
@ -18,7 +18,7 @@ class C2 {
|
||||
>yield : any
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C3.ts ===
|
||||
class C3 {
|
||||
>C3 : C3
|
||||
|
||||
@ -31,7 +31,7 @@ class C3 {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C4.ts ===
|
||||
class C4 {
|
||||
>C4 : C4
|
||||
|
||||
@ -45,7 +45,7 @@ class C4 {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C5.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C5.ts ===
|
||||
class C5 {
|
||||
>C5 : C5
|
||||
|
||||
@ -62,7 +62,7 @@ class C5 {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C6.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C6.ts ===
|
||||
class C6 {
|
||||
>C6 : C6
|
||||
|
||||
@ -75,7 +75,7 @@ class C6 {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C7.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C7.ts ===
|
||||
class C7 {
|
||||
>C7 : C7
|
||||
|
||||
@ -86,7 +86,7 @@ class C7 {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C8.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C8.ts ===
|
||||
class C8 {
|
||||
>C8 : C8
|
||||
|
||||
@ -103,7 +103,7 @@ class C8 {
|
||||
>g : () => void
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/C9.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/C9.ts ===
|
||||
class B9 {
|
||||
>B9 : B9
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/emitter/es2017/asyncGenerators/emitter.asyncGenerators.functionDeclarations.es2017.ts] ////
|
||||
//// [tests/cases/conformance/emitter/esnext/asyncGenerators/emitter.asyncGenerators.functionDeclarations.esnext.ts] ////
|
||||
|
||||
//// [F1.ts]
|
||||
async function * f1() {
|
||||
@ -1,43 +1,43 @@
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F1.ts ===
|
||||
async function * f1() {
|
||||
>f1 : Symbol(f1, Decl(F1.ts, 0, 0))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts ===
|
||||
async function * f2() {
|
||||
>f2 : Symbol(f2, Decl(F2.ts, 0, 0))
|
||||
|
||||
const x = yield;
|
||||
>x : Symbol(x, Decl(F2.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts ===
|
||||
async function * f3() {
|
||||
>f3 : Symbol(f3, Decl(F3.ts, 0, 0))
|
||||
|
||||
const x = yield 1;
|
||||
>x : Symbol(x, Decl(F3.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F4.ts ===
|
||||
async function * f4() {
|
||||
>f4 : Symbol(f4, Decl(F4.ts, 0, 0))
|
||||
|
||||
const x = yield* [1];
|
||||
>x : Symbol(x, Decl(F4.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F5.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts ===
|
||||
async function * f5() {
|
||||
>f5 : Symbol(f5, Decl(F5.ts, 0, 0))
|
||||
|
||||
const x = yield* (async function*() { yield 1; })();
|
||||
>x : Symbol(x, Decl(F5.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F6.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F6.ts ===
|
||||
async function * f6() {
|
||||
>f6 : Symbol(f6, Decl(F6.ts, 0, 0))
|
||||
|
||||
const x = await 1;
|
||||
>x : Symbol(x, Decl(F6.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F7.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts ===
|
||||
async function * f7() {
|
||||
>f7 : Symbol(f7, Decl(F7.ts, 0, 0))
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F1.ts ===
|
||||
async function * f1() {
|
||||
>f1 : () => AsyncIterableIterator<any>
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts ===
|
||||
async function * f2() {
|
||||
>f2 : () => AsyncIterableIterator<any>
|
||||
|
||||
@ -10,7 +10,7 @@ async function * f2() {
|
||||
>x : any
|
||||
>yield : any
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts ===
|
||||
async function * f3() {
|
||||
>f3 : () => AsyncIterableIterator<1>
|
||||
|
||||
@ -19,7 +19,7 @@ async function * f3() {
|
||||
>yield 1 : any
|
||||
>1 : 1
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F4.ts ===
|
||||
async function * f4() {
|
||||
>f4 : () => AsyncIterableIterator<number>
|
||||
|
||||
@ -29,7 +29,7 @@ async function * f4() {
|
||||
>[1] : number[]
|
||||
>1 : 1
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F5.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts ===
|
||||
async function * f5() {
|
||||
>f5 : () => AsyncIterableIterator<1>
|
||||
|
||||
@ -42,7 +42,7 @@ async function * f5() {
|
||||
>yield 1 : any
|
||||
>1 : 1
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F6.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F6.ts ===
|
||||
async function * f6() {
|
||||
>f6 : () => AsyncIterableIterator<any>
|
||||
|
||||
@ -51,7 +51,7 @@ async function * f6() {
|
||||
>await 1 : 1
|
||||
>1 : 1
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F7.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts ===
|
||||
async function * f7() {
|
||||
>f7 : () => AsyncIterableIterator<any>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/emitter/es2017/asyncGenerators/emitter.asyncGenerators.functionExpressions.es2017.ts] ////
|
||||
//// [tests/cases/conformance/emitter/esnext/asyncGenerators/emitter.asyncGenerators.functionExpressions.esnext.ts] ////
|
||||
|
||||
//// [F1.ts]
|
||||
const f1 = async function * () {
|
||||
@ -1,43 +1,43 @@
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F1.ts ===
|
||||
const f1 = async function * () {
|
||||
>f1 : Symbol(f1, Decl(F1.ts, 0, 5))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts ===
|
||||
const f2 = async function * () {
|
||||
>f2 : Symbol(f2, Decl(F2.ts, 0, 5))
|
||||
|
||||
const x = yield;
|
||||
>x : Symbol(x, Decl(F2.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts ===
|
||||
const f3 = async function * () {
|
||||
>f3 : Symbol(f3, Decl(F3.ts, 0, 5))
|
||||
|
||||
const x = yield 1;
|
||||
>x : Symbol(x, Decl(F3.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F4.ts ===
|
||||
const f4 = async function * () {
|
||||
>f4 : Symbol(f4, Decl(F4.ts, 0, 5))
|
||||
|
||||
const x = yield* [1];
|
||||
>x : Symbol(x, Decl(F4.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F5.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts ===
|
||||
const f5 = async function * () {
|
||||
>f5 : Symbol(f5, Decl(F5.ts, 0, 5))
|
||||
|
||||
const x = yield* (async function*() { yield 1; })();
|
||||
>x : Symbol(x, Decl(F5.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F6.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F6.ts ===
|
||||
const f6 = async function * () {
|
||||
>f6 : Symbol(f6, Decl(F6.ts, 0, 5))
|
||||
|
||||
const x = await 1;
|
||||
>x : Symbol(x, Decl(F6.ts, 1, 9))
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F7.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts ===
|
||||
const f7 = async function * () {
|
||||
>f7 : Symbol(f7, Decl(F7.ts, 0, 5))
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F1.ts ===
|
||||
const f1 = async function * () {
|
||||
>f1 : () => AsyncIterableIterator<any>
|
||||
>async function * () {} : () => AsyncIterableIterator<any>
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F2.ts ===
|
||||
const f2 = async function * () {
|
||||
>f2 : () => AsyncIterableIterator<any>
|
||||
>async function * () { const x = yield;} : () => AsyncIterableIterator<any>
|
||||
@ -12,7 +12,7 @@ const f2 = async function * () {
|
||||
>x : any
|
||||
>yield : any
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F3.ts ===
|
||||
const f3 = async function * () {
|
||||
>f3 : () => AsyncIterableIterator<1>
|
||||
>async function * () { const x = yield 1;} : () => AsyncIterableIterator<1>
|
||||
@ -22,7 +22,7 @@ const f3 = async function * () {
|
||||
>yield 1 : any
|
||||
>1 : 1
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F4.ts ===
|
||||
const f4 = async function * () {
|
||||
>f4 : () => AsyncIterableIterator<number>
|
||||
>async function * () { const x = yield* [1];} : () => AsyncIterableIterator<number>
|
||||
@ -33,7 +33,7 @@ const f4 = async function * () {
|
||||
>[1] : number[]
|
||||
>1 : 1
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F5.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F5.ts ===
|
||||
const f5 = async function * () {
|
||||
>f5 : () => AsyncIterableIterator<1>
|
||||
>async function * () { const x = yield* (async function*() { yield 1; })();} : () => AsyncIterableIterator<1>
|
||||
@ -47,7 +47,7 @@ const f5 = async function * () {
|
||||
>yield 1 : any
|
||||
>1 : 1
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F6.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F6.ts ===
|
||||
const f6 = async function * () {
|
||||
>f6 : () => AsyncIterableIterator<any>
|
||||
>async function * () { const x = await 1;} : () => AsyncIterableIterator<any>
|
||||
@ -57,7 +57,7 @@ const f6 = async function * () {
|
||||
>await 1 : 1
|
||||
>1 : 1
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/F7.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/F7.ts ===
|
||||
const f7 = async function * () {
|
||||
>f7 : () => AsyncIterableIterator<any>
|
||||
>async function * () { return 1;} : () => AsyncIterableIterator<any>
|
||||
@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/emitter/es2017/asyncGenerators/emitter.asyncGenerators.objectLiteralMethods.es2017.ts] ////
|
||||
//// [tests/cases/conformance/emitter/esnext/asyncGenerators/emitter.asyncGenerators.objectLiteralMethods.esnext.ts] ////
|
||||
|
||||
//// [O1.ts]
|
||||
const o1 = {
|
||||
@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O1.ts ===
|
||||
const o1 = {
|
||||
>o1 : Symbol(o1, Decl(O1.ts, 0, 5))
|
||||
|
||||
@ -6,7 +6,7 @@ const o1 = {
|
||||
>f : Symbol(f, Decl(O1.ts, 0, 12))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O2.ts ===
|
||||
const o2 = {
|
||||
>o2 : Symbol(o2, Decl(O2.ts, 0, 5))
|
||||
|
||||
@ -17,7 +17,7 @@ const o2 = {
|
||||
>x : Symbol(x, Decl(O2.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O3.ts ===
|
||||
const o3 = {
|
||||
>o3 : Symbol(o3, Decl(O3.ts, 0, 5))
|
||||
|
||||
@ -28,7 +28,7 @@ const o3 = {
|
||||
>x : Symbol(x, Decl(O3.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O4.ts ===
|
||||
const o4 = {
|
||||
>o4 : Symbol(o4, Decl(O4.ts, 0, 5))
|
||||
|
||||
@ -39,7 +39,7 @@ const o4 = {
|
||||
>x : Symbol(x, Decl(O4.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O5.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O5.ts ===
|
||||
const o5 = {
|
||||
>o5 : Symbol(o5, Decl(O5.ts, 0, 5))
|
||||
|
||||
@ -50,7 +50,7 @@ const o5 = {
|
||||
>x : Symbol(x, Decl(O5.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O6.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O6.ts ===
|
||||
const o6 = {
|
||||
>o6 : Symbol(o6, Decl(O6.ts, 0, 5))
|
||||
|
||||
@ -61,7 +61,7 @@ const o6 = {
|
||||
>x : Symbol(x, Decl(O6.ts, 2, 13))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O7.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O7.ts ===
|
||||
const o7 = {
|
||||
>o7 : Symbol(o7, Decl(O7.ts, 0, 5))
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O1.ts ===
|
||||
const o1 = {
|
||||
>o1 : { f(): AsyncIterableIterator<any>; }
|
||||
>{ async * f() { }} : { f(): AsyncIterableIterator<any>; }
|
||||
@ -7,7 +7,7 @@ const o1 = {
|
||||
>f : () => AsyncIterableIterator<any>
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O2.ts ===
|
||||
const o2 = {
|
||||
>o2 : { f(): AsyncIterableIterator<any>; }
|
||||
>{ async * f() { const x = yield; }} : { f(): AsyncIterableIterator<any>; }
|
||||
@ -20,7 +20,7 @@ const o2 = {
|
||||
>yield : any
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O3.ts ===
|
||||
const o3 = {
|
||||
>o3 : { f(): AsyncIterableIterator<1>; }
|
||||
>{ async * f() { const x = yield 1; }} : { f(): AsyncIterableIterator<1>; }
|
||||
@ -34,7 +34,7 @@ const o3 = {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O4.ts ===
|
||||
const o4 = {
|
||||
>o4 : { f(): AsyncIterableIterator<number>; }
|
||||
>{ async * f() { const x = yield* [1]; }} : { f(): AsyncIterableIterator<number>; }
|
||||
@ -49,7 +49,7 @@ const o4 = {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O5.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O5.ts ===
|
||||
const o5 = {
|
||||
>o5 : { f(): AsyncIterableIterator<1>; }
|
||||
>{ async * f() { const x = yield* (async function*() { yield 1; })(); }} : { f(): AsyncIterableIterator<1>; }
|
||||
@ -67,7 +67,7 @@ const o5 = {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O6.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O6.ts ===
|
||||
const o6 = {
|
||||
>o6 : { f(): AsyncIterableIterator<any>; }
|
||||
>{ async * f() { const x = await 1; }} : { f(): AsyncIterableIterator<any>; }
|
||||
@ -81,7 +81,7 @@ const o6 = {
|
||||
>1 : 1
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/asyncGenerators/O7.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/asyncGenerators/O7.ts ===
|
||||
const o7 = {
|
||||
>o7 : { f(): AsyncIterableIterator<any>; }
|
||||
>{ async * f() { return 1; }} : { f(): AsyncIterableIterator<any>; }
|
||||
@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/emitter/es2017/forAwait/emitter.forAwait.es2017.ts] ////
|
||||
//// [tests/cases/conformance/emitter/esnext/forAwait/emitter.forAwait.esnext.ts] ////
|
||||
|
||||
//// [file1.ts]
|
||||
async function f1() {
|
||||
@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/emitter/es2017/forAwait/file1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/forAwait/file1.ts ===
|
||||
async function f1() {
|
||||
>f1 : Symbol(f1, Decl(file1.ts, 0, 0))
|
||||
|
||||
@ -10,7 +10,7 @@ async function f1() {
|
||||
>y : Symbol(y, Decl(file1.ts, 1, 7))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/forAwait/file2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/forAwait/file2.ts ===
|
||||
async function f2() {
|
||||
>f2 : Symbol(f2, Decl(file2.ts, 0, 0))
|
||||
|
||||
@ -23,7 +23,7 @@ async function f2() {
|
||||
>y : Symbol(y, Decl(file2.ts, 1, 15))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/forAwait/file3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/forAwait/file3.ts ===
|
||||
async function* f3() {
|
||||
>f3 : Symbol(f3, Decl(file3.ts, 0, 0))
|
||||
|
||||
@ -35,7 +35,7 @@ async function* f3() {
|
||||
>y : Symbol(y, Decl(file3.ts, 1, 7))
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/forAwait/file4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/forAwait/file4.ts ===
|
||||
async function* f4() {
|
||||
>f4 : Symbol(f4, Decl(file4.ts, 0, 0))
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/emitter/es2017/forAwait/file1.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/forAwait/file1.ts ===
|
||||
async function f1() {
|
||||
>f1 : () => Promise<void>
|
||||
|
||||
@ -10,7 +10,7 @@ async function f1() {
|
||||
>y : any
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/forAwait/file2.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/forAwait/file2.ts ===
|
||||
async function f2() {
|
||||
>f2 : () => Promise<void>
|
||||
|
||||
@ -23,7 +23,7 @@ async function f2() {
|
||||
>y : any
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/forAwait/file3.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/forAwait/file3.ts ===
|
||||
async function* f3() {
|
||||
>f3 : () => AsyncIterableIterator<any>
|
||||
|
||||
@ -35,7 +35,7 @@ async function* f3() {
|
||||
>y : any
|
||||
}
|
||||
}
|
||||
=== tests/cases/conformance/emitter/es2017/forAwait/file4.ts ===
|
||||
=== tests/cases/conformance/emitter/esnext/forAwait/file4.ts ===
|
||||
async function* f4() {
|
||||
>f4 : () => AsyncIterableIterator<any>
|
||||
|
||||
@ -1,50 +1,50 @@
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorGetAccessorIsError.ts(2,17): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorPropertyIsError.ts(2,15): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorSetAccessorIsError.ts(2,17): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitInParameterInitializerIsError.ts(2,19): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMissingValueIsError.ts(3,14): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(2,15): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(2,15): error TS2693: 'await' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(2,20): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,18): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,24): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,18): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,26): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,28): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,34): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,36): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,28): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,36): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldAsTypeIsStrictError.ts(4,16): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInClassComputedPropertyIsError.ts(2,14): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInClassComputedPropertyIsError.ts(2,14): error TS2693: 'yield' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(2,15): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(2,15): error TS2693: 'yield' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(2,20): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingValueIsError.ts(3,16): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorGetAccessorIsError.ts(2,17): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorPropertyIsError.ts(2,15): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorSetAccessorIsError.ts(2,17): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts(2,19): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts(3,14): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,15): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,15): error TS2693: 'await' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,20): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,18): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,24): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,18): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,26): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,28): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,34): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,36): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,28): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,36): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsStrictError.ts(4,16): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInClassComputedPropertyIsError.ts(2,14): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInClassComputedPropertyIsError.ts(2,14): error TS2693: 'yield' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS1163: A 'yield' expression is only allowed in a generator body.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,15): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,15): error TS2693: 'yield' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,20): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts(3,16): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/methodIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/methodIsOk.ts (0 errors) ====
|
||||
class C1 {
|
||||
async * f() {
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMethodNameIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMethodNameIsOk.ts (0 errors) ====
|
||||
class C2 {
|
||||
async * await() {
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldMethodNameIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldMethodNameIsOk.ts (0 errors) ====
|
||||
class C3 {
|
||||
async * yield() {
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts (4 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts (4 errors) ====
|
||||
class C4 {
|
||||
async * f(await) {
|
||||
~~~~~
|
||||
@ -57,7 +57,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts (4 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts (4 errors) ====
|
||||
class C5 {
|
||||
async * f(yield) {
|
||||
~~~~~
|
||||
@ -70,14 +70,14 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ====
|
||||
class C6 {
|
||||
async * f(a = await 1) {
|
||||
~~~~~~~
|
||||
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts (2 errors) ====
|
||||
class C7 {
|
||||
async * f(a = yield) {
|
||||
~~~~~
|
||||
@ -86,14 +86,14 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ====
|
||||
class C8 {
|
||||
async * f() {
|
||||
async function * g() {
|
||||
}
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ====
|
||||
class C9 {
|
||||
async * f() {
|
||||
function yield() {
|
||||
@ -104,7 +104,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
}
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ====
|
||||
class C10 {
|
||||
async * f() {
|
||||
const x = function yield() {
|
||||
@ -115,7 +115,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
};
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ====
|
||||
class C11 {
|
||||
async * f() {
|
||||
function await() {
|
||||
@ -128,7 +128,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
}
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ====
|
||||
class C12 {
|
||||
async * f() {
|
||||
const x = function await() {
|
||||
@ -141,19 +141,19 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
};
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldIsOk.ts (0 errors) ====
|
||||
class C13 {
|
||||
async * f() {
|
||||
yield;
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ====
|
||||
class C14 {
|
||||
async * f() {
|
||||
yield 1;
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ====
|
||||
class C15 {
|
||||
async * f() {
|
||||
yield *;
|
||||
@ -161,19 +161,19 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ====
|
||||
class C16 {
|
||||
async * f() {
|
||||
yield * [];
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ====
|
||||
class C17 {
|
||||
async * f() {
|
||||
await 1;
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ====
|
||||
class C18 {
|
||||
async * f() {
|
||||
await;
|
||||
@ -181,14 +181,14 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ====
|
||||
interface await {}
|
||||
class C19 {
|
||||
async * f() {
|
||||
let x: await;
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldAsTypeIsStrictError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsStrictError.ts (1 errors) ====
|
||||
interface yield {}
|
||||
class C20 {
|
||||
async * f() {
|
||||
@ -197,7 +197,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInClassComputedPropertyIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInClassComputedPropertyIsError.ts (2 errors) ====
|
||||
class C21 {
|
||||
async * [yield]() {
|
||||
~~~~~
|
||||
@ -206,13 +206,13 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS2693: 'yield' only refers to a type, but is being used as a value here.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ====
|
||||
class C22 {
|
||||
async * f() {
|
||||
const x = { [yield]: 1 };
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorGetAccessorIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorGetAccessorIsError.ts (1 errors) ====
|
||||
class C23 {
|
||||
async * get x() {
|
||||
~
|
||||
@ -220,14 +220,14 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorSetAccessorIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorSetAccessorIsError.ts (1 errors) ====
|
||||
class C24 {
|
||||
async * set x(value: number) {
|
||||
~
|
||||
!!! error TS1005: '(' expected.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorPropertyIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorPropertyIsError.ts (1 errors) ====
|
||||
class C25 {
|
||||
async * x = 1;
|
||||
~
|
||||
@ -1,61 +1,61 @@
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitInParameterInitializerIsError.ts(1,25): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMissingValueIsError.ts(2,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(1,21): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(1,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,14): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,20): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,22): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,14): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,22): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,32): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,32): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts(1,25): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(1,21): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(1,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingValueIsError.ts(2,12): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts(1,25): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts(2,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,21): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,14): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,20): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,22): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,14): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,22): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,32): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,32): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(1,25): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,21): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts(2,12): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/functionDeclarationIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/functionDeclarationIsOk.ts (0 errors) ====
|
||||
async function * f1() {
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitNameIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsOk.ts (0 errors) ====
|
||||
async function * await() {
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldNameIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsOk.ts (0 errors) ====
|
||||
async function * yield() {
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts (2 errors) ====
|
||||
async function * f4(await) {
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts (2 errors) ====
|
||||
async function * f5(yield) {
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ====
|
||||
async function * f6(a = await 1) {
|
||||
~~~~~~~
|
||||
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ====
|
||||
async function * f7(a = yield) {
|
||||
~~~~~
|
||||
!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ====
|
||||
async function * f8() {
|
||||
async function * g() {
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ====
|
||||
async function * f9() {
|
||||
function yield() {
|
||||
~~~~~
|
||||
@ -64,7 +64,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1005: '=>' expected.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ====
|
||||
async function * f10() {
|
||||
const x = function yield() {
|
||||
~~~~~
|
||||
@ -73,7 +73,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1005: '=>' expected.
|
||||
};
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ====
|
||||
async function * f11() {
|
||||
function await() {
|
||||
~~~~~
|
||||
@ -84,7 +84,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (2 errors) ====
|
||||
async function * f12() {
|
||||
const x = function yield() {
|
||||
~~~~~
|
||||
@ -93,45 +93,45 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1005: '=>' expected.
|
||||
};
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldIsOk.ts (0 errors) ====
|
||||
async function * f13() {
|
||||
yield;
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ====
|
||||
async function * f14() {
|
||||
yield 1;
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ====
|
||||
async function * f15() {
|
||||
yield *;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ====
|
||||
async function * f16() {
|
||||
yield * [];
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ====
|
||||
async function * f17() {
|
||||
await 1;
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ====
|
||||
async function * f18() {
|
||||
await;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ====
|
||||
interface await {}
|
||||
async function * f19() {
|
||||
let x: await;
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ====
|
||||
interface yield {}
|
||||
async function * f20() {
|
||||
let x: yield;
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ====
|
||||
async function * f21() {
|
||||
const x = { [yield]: 1 };
|
||||
}
|
||||
@ -1,37 +1,37 @@
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitInParameterInitializerIsError.ts(1,34): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMissingValueIsError.ts(2,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitNameIsError.ts(1,29): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitNameIsError.ts(1,29): error TS2451: Cannot redeclare block-scoped variable 'await'.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitNameIsError.ts(1,34): error TS1005: '=' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitNameIsError.ts(1,37): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(1,30): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(1,30): error TS2451: Cannot redeclare block-scoped variable 'await'.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(1,35): error TS1005: ',' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,14): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,20): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,22): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,14): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,22): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,30): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,32): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,32): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts(1,34): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldNameIsError.ts(1,29): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldNameIsError.ts(1,29): error TS2451: Cannot redeclare block-scoped variable 'yield'.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldNameIsError.ts(1,34): error TS1005: '=' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldNameIsError.ts(1,37): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(1,30): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(1,30): error TS2451: Cannot redeclare block-scoped variable 'yield'.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(1,35): error TS1005: ',' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingValueIsError.ts(2,12): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts(1,34): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts(2,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts(1,29): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts(1,29): error TS2451: Cannot redeclare block-scoped variable 'await'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts(1,34): error TS1005: '=' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts(1,37): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,30): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,30): error TS2451: Cannot redeclare block-scoped variable 'await'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(1,35): error TS1005: ',' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,14): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,20): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(2,22): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,14): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(2,22): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,30): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(2,32): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,24): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(2,32): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(1,34): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts(1,29): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts(1,29): error TS2451: Cannot redeclare block-scoped variable 'yield'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts(1,34): error TS1005: '=' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts(1,37): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,30): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,30): error TS2451: Cannot redeclare block-scoped variable 'yield'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(1,35): error TS1005: ',' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts(2,12): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/functionExpressionIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/functionExpressionIsOk.ts (0 errors) ====
|
||||
const f1 = async function * f() {
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitNameIsError.ts (4 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitNameIsError.ts (4 errors) ====
|
||||
const f2 = async function * await() {
|
||||
~~~~~
|
||||
!!! error TS1005: '(' expected.
|
||||
@ -42,7 +42,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
~
|
||||
!!! error TS1005: '=>' expected.
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldNameIsError.ts (4 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldNameIsError.ts (4 errors) ====
|
||||
const f3 = async function * yield() {
|
||||
~~~~~
|
||||
!!! error TS1005: '(' expected.
|
||||
@ -53,7 +53,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
~
|
||||
!!! error TS1005: '=>' expected.
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts (3 errors) ====
|
||||
const f4 = async function * (await) {
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
@ -62,7 +62,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts (3 errors) ====
|
||||
const f5 = async function * (yield) {
|
||||
~~~~~
|
||||
!!! error TS1138: Parameter declaration expected.
|
||||
@ -71,22 +71,22 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ====
|
||||
const f6 = async function * (a = await 1) {
|
||||
~~~~~~~
|
||||
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ====
|
||||
const f7 = async function * (a = yield) {
|
||||
~~~~~
|
||||
!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ====
|
||||
const f8 = async function * () {
|
||||
async function * g() {
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ====
|
||||
const f9 = async function * () {
|
||||
function yield() {
|
||||
~~~~~
|
||||
@ -95,7 +95,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1005: '=>' expected.
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ====
|
||||
const f10 = async function * () {
|
||||
const x = function yield() {
|
||||
~~~~~
|
||||
@ -104,7 +104,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1005: '=>' expected.
|
||||
};
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ====
|
||||
const f11 = async function * () {
|
||||
function await() {
|
||||
~~~~~
|
||||
@ -115,7 +115,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ====
|
||||
const f12 = async function * () {
|
||||
const x = function await() {
|
||||
~~~~~
|
||||
@ -126,45 +126,45 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1005: ';' expected.
|
||||
};
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldIsOk.ts (0 errors) ====
|
||||
const f13 = async function * () {
|
||||
yield;
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ====
|
||||
const f14 = async function * () {
|
||||
yield 1;
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ====
|
||||
const f15 = async function * () {
|
||||
yield *;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ====
|
||||
const f16 = async function * () {
|
||||
yield * [];
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ====
|
||||
const f17 = async function * () {
|
||||
await 1;
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ====
|
||||
const f18 = async function * () {
|
||||
await;
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ====
|
||||
interface await {}
|
||||
const f19 = async function * () {
|
||||
let x: await;
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ====
|
||||
interface yield {}
|
||||
const f20 = async function * () {
|
||||
let x: yield;
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ====
|
||||
const f21 = async function *() {
|
||||
const x = { [yield]: 1 };
|
||||
};
|
||||
@ -1,46 +1,46 @@
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorGetAccessorIsError.ts(2,17): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorPropertyIsError.ts(2,14): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorSetAccessorIsError.ts(2,17): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitInParameterInitializerIsError.ts(2,19): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMissingValueIsError.ts(3,14): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(2,15): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(2,20): error TS1005: ':' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(2,22): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,18): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,24): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,18): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,26): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,28): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,34): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,36): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,28): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,36): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(2,15): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(2,20): error TS1005: ':' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(2,22): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingValueIsError.ts(3,16): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorGetAccessorIsError.ts(2,17): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorPropertyIsError.ts(2,14): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorSetAccessorIsError.ts(2,17): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts(2,19): error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts(3,14): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,15): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,20): error TS1005: ':' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(2,22): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,18): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,24): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts(3,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,18): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts(3,26): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,28): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,34): error TS1109: Expression expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts(3,36): error TS1005: ';' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,28): error TS1005: '(' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts(3,36): error TS1005: '=>' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts(2,19): error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,15): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,20): error TS1005: ':' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(2,22): error TS1136: Property assignment expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts(4,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts(3,16): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/methodIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/methodIsOk.ts (0 errors) ====
|
||||
const o1 = {
|
||||
async * f() {
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMethodNameIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMethodNameIsOk.ts (0 errors) ====
|
||||
const o2 = {
|
||||
async * await() {
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldMethodNameIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldMethodNameIsOk.ts (0 errors) ====
|
||||
const o3 = {
|
||||
async * yield() {
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitParameterIsError.ts (4 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitParameterIsError.ts (4 errors) ====
|
||||
const o4 = {
|
||||
async * f(await) {
|
||||
~~~~~
|
||||
@ -53,7 +53,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
};
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldParameterIsError.ts (4 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldParameterIsError.ts (4 errors) ====
|
||||
const o5 = {
|
||||
async * f(yield) {
|
||||
~~~~~
|
||||
@ -66,28 +66,28 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
};
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitInParameterInitializerIsError.ts (1 errors) ====
|
||||
const o6 = {
|
||||
async * f(a = await 1) {
|
||||
~~~~~~~
|
||||
!!! error TS2524: 'await' expressions cannot be used in a parameter initializer.
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInParameterInitializerIsError.ts (1 errors) ====
|
||||
const o7 = {
|
||||
async * f(a = yield) {
|
||||
~~~~~
|
||||
!!! error TS2523: 'yield' expressions cannot be used in a parameter initializer.
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedAsyncGeneratorIsOk.ts (0 errors) ====
|
||||
const o8 = {
|
||||
async * f() {
|
||||
async function * g() {
|
||||
}
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedYieldIsError.ts (2 errors) ====
|
||||
const o9 = {
|
||||
async * f() {
|
||||
function yield() {
|
||||
@ -98,7 +98,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
}
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedYieldIsError.ts (2 errors) ====
|
||||
const o10 = {
|
||||
async * f() {
|
||||
const x = function yield() {
|
||||
@ -109,7 +109,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
};
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionDeclarationNamedAwaitIsError.ts (3 errors) ====
|
||||
const o11 = {
|
||||
async * f() {
|
||||
function await() {
|
||||
@ -122,7 +122,7 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
}
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/nestedFunctionExpressionNamedAwaitIsError.ts (3 errors) ====
|
||||
const o12 = {
|
||||
async * f() {
|
||||
const x = function await() {
|
||||
@ -135,19 +135,19 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
};
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldIsOk.ts (0 errors) ====
|
||||
const o13 = {
|
||||
async * f() {
|
||||
yield;
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldWithValueIsOk.ts (0 errors) ====
|
||||
const o14 = {
|
||||
async * f() {
|
||||
yield 1;
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarMissingValueIsError.ts (1 errors) ====
|
||||
const o15 = {
|
||||
async * f() {
|
||||
yield *;
|
||||
@ -155,19 +155,19 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldStarWithValueIsOk.ts (0 errors) ====
|
||||
const o16 = {
|
||||
async * f() {
|
||||
yield * [];
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitWithValueIsOk.ts (0 errors) ====
|
||||
const o17 = {
|
||||
async * f() {
|
||||
await 1;
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitMissingValueIsError.ts (1 errors) ====
|
||||
const o18 = {
|
||||
async * f() {
|
||||
await;
|
||||
@ -175,27 +175,27 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/awaitAsTypeIsOk.ts (0 errors) ====
|
||||
interface await {}
|
||||
const o19 = {
|
||||
async * f() {
|
||||
let x: await;
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldAsTypeIsOk.ts (0 errors) ====
|
||||
interface yield {}
|
||||
const o20 = {
|
||||
async * f() {
|
||||
let x: yield;
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/yieldInNestedComputedPropertyIsOk.ts (0 errors) ====
|
||||
const o21 = {
|
||||
async * f() {
|
||||
const x = { [yield]: 1 };
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorGetAccessorIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorGetAccessorIsError.ts (1 errors) ====
|
||||
const o22 = {
|
||||
async * get x() {
|
||||
~
|
||||
@ -203,14 +203,14 @@ tests/cases/conformance/parser/ecmascript2017/asyncGenerators/yieldStarMissingVa
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorSetAccessorIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorSetAccessorIsError.ts (1 errors) ====
|
||||
const o23 = {
|
||||
async * set x(value: number) {
|
||||
~
|
||||
!!! error TS1005: '(' expected.
|
||||
}
|
||||
};
|
||||
==== tests/cases/conformance/parser/ecmascript2017/asyncGenerators/asyncGeneratorPropertyIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/asyncGenerators/asyncGeneratorPropertyIsError.ts (1 errors) ====
|
||||
const o24 = {
|
||||
async * x: 1;
|
||||
~
|
||||
@ -1,27 +1,27 @@
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/forAwaitInWithDeclIsError.ts(1,20): error TS1005: 'of' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/forAwaitInWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/forAwaitInWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/forAwaitInWithExprIsError.ts(1,14): error TS1005: 'of' expected.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/forAwaitInWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/inFunctionDeclWithDeclIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/inFunctionDeclWithExprIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/inGeneratorWithDeclIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/inGeneratorWithExprIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.ts(1,5): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithDeclIsError.ts(1,20): error TS1005: 'of' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithExprIsError.ts(1,14): error TS1005: 'of' expected.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/inFunctionDeclWithDeclIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/inFunctionDeclWithExprIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/inGeneratorWithDeclIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/inGeneratorWithExprIsError.ts(3,9): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithExprIsError.ts(1,5): error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithDeclIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithDeclIsError.ts (2 errors) ====
|
||||
for await (const x of y) {
|
||||
~~~~~
|
||||
!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'y'.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/topLevelWithExprIsError.ts (3 errors) ====
|
||||
for await (x of y) {
|
||||
~~~~~
|
||||
!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
@ -30,14 +30,14 @@ tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.t
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'y'.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/forAwaitInWithDeclIsError.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithDeclIsError.ts (2 errors) ====
|
||||
for await (const x in y) {
|
||||
~~
|
||||
!!! error TS1005: 'of' expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'y'.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/forAwaitInWithExprIsError.ts (3 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/forAwaitInWithExprIsError.ts (3 errors) ====
|
||||
for await (x in y) {
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
@ -46,7 +46,7 @@ tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.t
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'y'.
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/inFunctionDeclWithDeclIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inFunctionDeclWithDeclIsError.ts (1 errors) ====
|
||||
function f5() {
|
||||
let y: any;
|
||||
for await (const x of y) {
|
||||
@ -54,7 +54,7 @@ tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.t
|
||||
!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/inFunctionDeclWithExprIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inFunctionDeclWithExprIsError.ts (1 errors) ====
|
||||
function f6() {
|
||||
let x: any, y: any;
|
||||
for await (x of y) {
|
||||
@ -62,31 +62,31 @@ tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.t
|
||||
!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/inAsyncFunctionWithDeclIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inAsyncFunctionWithDeclIsOk.ts (0 errors) ====
|
||||
async function f7() {
|
||||
let y: any;
|
||||
for await (const x of y) {
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/inAsyncFunctionWithExprIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inAsyncFunctionWithExprIsOk.ts (0 errors) ====
|
||||
async function f8() {
|
||||
let x: any, y: any;
|
||||
for await (x of y) {
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/inAsyncGeneratorWithDeclIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inAsyncGeneratorWithDeclIsOk.ts (0 errors) ====
|
||||
async function* f9() {
|
||||
let y: any;
|
||||
for await (const x of y) {
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/inAsyncGeneratorWithExpressionIsOk.ts (0 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inAsyncGeneratorWithExpressionIsOk.ts (0 errors) ====
|
||||
async function* f10() {
|
||||
let x: any, y: any;
|
||||
for await (x of y) {
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/inGeneratorWithDeclIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inGeneratorWithDeclIsError.ts (1 errors) ====
|
||||
function* f11() {
|
||||
let y: any;
|
||||
for await (const x of y) {
|
||||
@ -94,7 +94,7 @@ tests/cases/conformance/parser/ecmascript2017/forAwait/topLevelWithExprIsError.t
|
||||
!!! error TS1103: A 'for-await-of' statement is only allowed within an async function or async generator.
|
||||
}
|
||||
}
|
||||
==== tests/cases/conformance/parser/ecmascript2017/forAwait/inGeneratorWithExprIsError.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascriptnext/forAwait/inGeneratorWithExprIsError.ts (1 errors) ====
|
||||
function* f12() {
|
||||
let x: any, y: any;
|
||||
for await (x of y) {
|
||||
@ -1,151 +1,151 @@
|
||||
=== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.1.ts ===
|
||||
=== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.1.ts ===
|
||||
async function * inferReturnType1() {
|
||||
>inferReturnType1 : Symbol(inferReturnType1, Decl(types.asyncGenerators.es2017.1.ts, 0, 0))
|
||||
>inferReturnType1 : Symbol(inferReturnType1, Decl(types.asyncGenerators.esnext.1.ts, 0, 0))
|
||||
}
|
||||
async function * inferReturnType2() {
|
||||
>inferReturnType2 : Symbol(inferReturnType2, Decl(types.asyncGenerators.es2017.1.ts, 1, 1))
|
||||
>inferReturnType2 : Symbol(inferReturnType2, Decl(types.asyncGenerators.esnext.1.ts, 1, 1))
|
||||
|
||||
yield;
|
||||
}
|
||||
async function * inferReturnType3() {
|
||||
>inferReturnType3 : Symbol(inferReturnType3, Decl(types.asyncGenerators.es2017.1.ts, 4, 1))
|
||||
>inferReturnType3 : Symbol(inferReturnType3, Decl(types.asyncGenerators.esnext.1.ts, 4, 1))
|
||||
|
||||
yield 1;
|
||||
}
|
||||
async function * inferReturnType4() {
|
||||
>inferReturnType4 : Symbol(inferReturnType4, Decl(types.asyncGenerators.es2017.1.ts, 7, 1))
|
||||
>inferReturnType4 : Symbol(inferReturnType4, Decl(types.asyncGenerators.esnext.1.ts, 7, 1))
|
||||
|
||||
yield* [1, 2];
|
||||
}
|
||||
async function * inferReturnType5() {
|
||||
>inferReturnType5 : Symbol(inferReturnType5, Decl(types.asyncGenerators.es2017.1.ts, 10, 1))
|
||||
>inferReturnType5 : Symbol(inferReturnType5, Decl(types.asyncGenerators.esnext.1.ts, 10, 1))
|
||||
|
||||
yield* (async function * () { yield 1; })();
|
||||
}
|
||||
const assignability1: () => AsyncIterableIterator<number> = async function * () {
|
||||
>assignability1 : Symbol(assignability1, Decl(types.asyncGenerators.es2017.1.ts, 14, 5))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability1 : Symbol(assignability1, Decl(types.asyncGenerators.esnext.1.ts, 14, 5))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield 1;
|
||||
};
|
||||
const assignability2: () => AsyncIterableIterator<number> = async function * () {
|
||||
>assignability2 : Symbol(assignability2, Decl(types.asyncGenerators.es2017.1.ts, 17, 5))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability2 : Symbol(assignability2, Decl(types.asyncGenerators.esnext.1.ts, 17, 5))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* [1, 2];
|
||||
};
|
||||
const assignability3: () => AsyncIterableIterator<number> = async function * () {
|
||||
>assignability3 : Symbol(assignability3, Decl(types.asyncGenerators.es2017.1.ts, 20, 5))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability3 : Symbol(assignability3, Decl(types.asyncGenerators.esnext.1.ts, 20, 5))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* (async function * () { yield 1; })();
|
||||
};
|
||||
const assignability4: () => AsyncIterable<number> = async function * () {
|
||||
>assignability4 : Symbol(assignability4, Decl(types.asyncGenerators.es2017.1.ts, 23, 5))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability4 : Symbol(assignability4, Decl(types.asyncGenerators.esnext.1.ts, 23, 5))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield 1;
|
||||
};
|
||||
const assignability5: () => AsyncIterable<number> = async function * () {
|
||||
>assignability5 : Symbol(assignability5, Decl(types.asyncGenerators.es2017.1.ts, 26, 5))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability5 : Symbol(assignability5, Decl(types.asyncGenerators.esnext.1.ts, 26, 5))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* [1, 2];
|
||||
};
|
||||
const assignability6: () => AsyncIterable<number> = async function * () {
|
||||
>assignability6 : Symbol(assignability6, Decl(types.asyncGenerators.es2017.1.ts, 29, 5))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability6 : Symbol(assignability6, Decl(types.asyncGenerators.esnext.1.ts, 29, 5))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* (async function * () { yield 1; })();
|
||||
};
|
||||
const assignability7: () => AsyncIterator<number> = async function * () {
|
||||
>assignability7 : Symbol(assignability7, Decl(types.asyncGenerators.es2017.1.ts, 32, 5))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability7 : Symbol(assignability7, Decl(types.asyncGenerators.esnext.1.ts, 32, 5))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield 1;
|
||||
};
|
||||
const assignability8: () => AsyncIterator<number> = async function * () {
|
||||
>assignability8 : Symbol(assignability8, Decl(types.asyncGenerators.es2017.1.ts, 35, 5))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability8 : Symbol(assignability8, Decl(types.asyncGenerators.esnext.1.ts, 35, 5))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* [1, 2];
|
||||
};
|
||||
const assignability9: () => AsyncIterator<number> = async function * () {
|
||||
>assignability9 : Symbol(assignability9, Decl(types.asyncGenerators.es2017.1.ts, 38, 5))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>assignability9 : Symbol(assignability9, Decl(types.asyncGenerators.esnext.1.ts, 38, 5))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* (async function * () { yield 1; })();
|
||||
};
|
||||
async function * explicitReturnType1(): AsyncIterableIterator<number> {
|
||||
>explicitReturnType1 : Symbol(explicitReturnType1, Decl(types.asyncGenerators.es2017.1.ts, 40, 2))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType1 : Symbol(explicitReturnType1, Decl(types.asyncGenerators.esnext.1.ts, 40, 2))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield 1;
|
||||
}
|
||||
async function * explicitReturnType2(): AsyncIterableIterator<number> {
|
||||
>explicitReturnType2 : Symbol(explicitReturnType2, Decl(types.asyncGenerators.es2017.1.ts, 43, 1))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType2 : Symbol(explicitReturnType2, Decl(types.asyncGenerators.esnext.1.ts, 43, 1))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* [1, 2];
|
||||
}
|
||||
async function * explicitReturnType3(): AsyncIterableIterator<number> {
|
||||
>explicitReturnType3 : Symbol(explicitReturnType3, Decl(types.asyncGenerators.es2017.1.ts, 46, 1))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType3 : Symbol(explicitReturnType3, Decl(types.asyncGenerators.esnext.1.ts, 46, 1))
|
||||
>AsyncIterableIterator : Symbol(AsyncIterableIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* (async function * () { yield 1; })();
|
||||
}
|
||||
async function * explicitReturnType4(): AsyncIterable<number> {
|
||||
>explicitReturnType4 : Symbol(explicitReturnType4, Decl(types.asyncGenerators.es2017.1.ts, 49, 1))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType4 : Symbol(explicitReturnType4, Decl(types.asyncGenerators.esnext.1.ts, 49, 1))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield 1;
|
||||
}
|
||||
async function * explicitReturnType5(): AsyncIterable<number> {
|
||||
>explicitReturnType5 : Symbol(explicitReturnType5, Decl(types.asyncGenerators.es2017.1.ts, 52, 1))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType5 : Symbol(explicitReturnType5, Decl(types.asyncGenerators.esnext.1.ts, 52, 1))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* [1, 2];
|
||||
}
|
||||
async function * explicitReturnType6(): AsyncIterable<number> {
|
||||
>explicitReturnType6 : Symbol(explicitReturnType6, Decl(types.asyncGenerators.es2017.1.ts, 55, 1))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType6 : Symbol(explicitReturnType6, Decl(types.asyncGenerators.esnext.1.ts, 55, 1))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* (async function * () { yield 1; })();
|
||||
}
|
||||
async function * explicitReturnType7(): AsyncIterator<number> {
|
||||
>explicitReturnType7 : Symbol(explicitReturnType7, Decl(types.asyncGenerators.es2017.1.ts, 58, 1))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType7 : Symbol(explicitReturnType7, Decl(types.asyncGenerators.esnext.1.ts, 58, 1))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield 1;
|
||||
}
|
||||
async function * explicitReturnType8(): AsyncIterator<number> {
|
||||
>explicitReturnType8 : Symbol(explicitReturnType8, Decl(types.asyncGenerators.es2017.1.ts, 61, 1))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType8 : Symbol(explicitReturnType8, Decl(types.asyncGenerators.esnext.1.ts, 61, 1))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* [1, 2];
|
||||
}
|
||||
async function * explicitReturnType9(): AsyncIterator<number> {
|
||||
>explicitReturnType9 : Symbol(explicitReturnType9, Decl(types.asyncGenerators.es2017.1.ts, 64, 1))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
>explicitReturnType9 : Symbol(explicitReturnType9, Decl(types.asyncGenerators.esnext.1.ts, 64, 1))
|
||||
>AsyncIterator : Symbol(AsyncIterator, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
yield* (async function * () { yield 1; })();
|
||||
}
|
||||
async function * explicitReturnType10(): {} {
|
||||
>explicitReturnType10 : Symbol(explicitReturnType10, Decl(types.asyncGenerators.es2017.1.ts, 67, 1))
|
||||
>explicitReturnType10 : Symbol(explicitReturnType10, Decl(types.asyncGenerators.esnext.1.ts, 67, 1))
|
||||
|
||||
yield 1;
|
||||
}
|
||||
async function * awaitedType1() {
|
||||
>awaitedType1 : Symbol(awaitedType1, Decl(types.asyncGenerators.es2017.1.ts, 70, 1))
|
||||
>awaitedType1 : Symbol(awaitedType1, Decl(types.asyncGenerators.esnext.1.ts, 70, 1))
|
||||
|
||||
const x = await 1;
|
||||
>x : Symbol(x, Decl(types.asyncGenerators.es2017.1.ts, 72, 9))
|
||||
>x : Symbol(x, Decl(types.asyncGenerators.esnext.1.ts, 72, 9))
|
||||
}
|
||||
async function * awaitedType2() {
|
||||
>awaitedType2 : Symbol(awaitedType2, Decl(types.asyncGenerators.es2017.1.ts, 73, 1))
|
||||
>awaitedType2 : Symbol(awaitedType2, Decl(types.asyncGenerators.esnext.1.ts, 73, 1))
|
||||
|
||||
const x = await Promise.resolve(1);
|
||||
>x : Symbol(x, Decl(types.asyncGenerators.es2017.1.ts, 75, 9))
|
||||
>x : Symbol(x, Decl(types.asyncGenerators.esnext.1.ts, 75, 9))
|
||||
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
|
||||
@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.1.ts ===
|
||||
=== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.1.ts ===
|
||||
async function * inferReturnType1() {
|
||||
>inferReturnType1 : () => AsyncIterableIterator<any>
|
||||
}
|
||||
@ -1,14 +1,14 @@
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(2,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(7,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(2,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(7,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator<number>'.
|
||||
Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator<number>'.
|
||||
Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(10,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterableIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(10,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterableIterator<number>'.
|
||||
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterableIterator<number>'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(13,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(13,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterableIterator<number>'.
|
||||
Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterableIterator<number>'.
|
||||
Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(16,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(16,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable<number>'.
|
||||
Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable<number>'.
|
||||
Types of property '[Symbol.asyncIterator]' are incompatible.
|
||||
Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator<number>'.
|
||||
@ -18,7 +18,7 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(
|
||||
Type 'Promise<IteratorResult<"a">>' is not assignable to type 'Promise<IteratorResult<number>>'.
|
||||
Type 'IteratorResult<"a">' is not assignable to type 'IteratorResult<number>'.
|
||||
Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(19,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterable<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(19,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterable<number>'.
|
||||
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterable<number>'.
|
||||
Types of property '[Symbol.asyncIterator]' are incompatible.
|
||||
Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
||||
@ -28,36 +28,36 @@ tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(
|
||||
Type 'Promise<IteratorResult<string>>' is not assignable to type 'Promise<IteratorResult<number>>'.
|
||||
Type 'IteratorResult<string>' is not assignable to type 'IteratorResult<number>'.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(22,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(22,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterable<number>'.
|
||||
Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterable<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(25,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(25,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator<number>'.
|
||||
Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(28,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(28,7): error TS2322: Type '() => AsyncIterableIterator<string>' is not assignable to type '() => AsyncIterator<number>'.
|
||||
Type 'AsyncIterableIterator<string>' is not assignable to type 'AsyncIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(31,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(31,7): error TS2322: Type '() => AsyncIterableIterator<"a">' is not assignable to type '() => AsyncIterator<number>'.
|
||||
Type 'AsyncIterableIterator<"a">' is not assignable to type 'AsyncIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(35,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(38,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(41,12): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(44,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(47,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(50,12): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(53,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(56,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(59,12): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(61,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'IterableIterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(35,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(38,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(41,12): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(44,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(47,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(50,12): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(53,11): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(56,12): error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(59,12): error TS2322: Type '"a"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(61,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'IterableIterator<number>'.
|
||||
Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator<any>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(64,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'Iterable<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(64,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'Iterable<number>'.
|
||||
Property '[Symbol.iterator]' is missing in type 'AsyncIterableIterator<any>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(67,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'Iterator<number>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(67,42): error TS2322: Type 'AsyncIterableIterator<any>' is not assignable to type 'Iterator<number>'.
|
||||
Types of property 'next' are incompatible.
|
||||
Type '(value?: any) => Promise<IteratorResult<any>>' is not assignable to type '(value?: any) => IteratorResult<number>'.
|
||||
Type 'Promise<IteratorResult<any>>' is not assignable to type 'IteratorResult<number>'.
|
||||
Property 'done' is missing in type 'Promise<IteratorResult<any>>'.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts(71,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts(71,12): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.es2017.2.ts (23 errors) ====
|
||||
==== tests/cases/conformance/types/asyncGenerators/types.asyncGenerators.esnext.2.ts (23 errors) ====
|
||||
async function * inferReturnType1() {
|
||||
yield* {};
|
||||
~~
|
||||
@ -1,55 +0,0 @@
|
||||
=== tests/cases/conformance/types/forAwait/types.forAwait.es2017.1.ts ===
|
||||
declare const asyncIterable: AsyncIterable<number>;
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.es2017.1.ts, 0, 13))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.es2017.asynciterable.d.ts, --, --))
|
||||
|
||||
declare const iterable: Iterable<number>;
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.es2017.1.ts, 1, 13))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
|
||||
async function f1() {
|
||||
>f1 : Symbol(f1, Decl(types.forAwait.es2017.1.ts, 1, 41))
|
||||
|
||||
let y: number;
|
||||
>y : Symbol(y, Decl(types.forAwait.es2017.1.ts, 3, 7))
|
||||
|
||||
for await (const x of asyncIterable) {
|
||||
>x : Symbol(x, Decl(types.forAwait.es2017.1.ts, 4, 20))
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.es2017.1.ts, 0, 13))
|
||||
}
|
||||
for await (const x of iterable) {
|
||||
>x : Symbol(x, Decl(types.forAwait.es2017.1.ts, 6, 20))
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.es2017.1.ts, 1, 13))
|
||||
}
|
||||
for await (y of asyncIterable) {
|
||||
>y : Symbol(y, Decl(types.forAwait.es2017.1.ts, 3, 7))
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.es2017.1.ts, 0, 13))
|
||||
}
|
||||
for await (y of iterable) {
|
||||
>y : Symbol(y, Decl(types.forAwait.es2017.1.ts, 3, 7))
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.es2017.1.ts, 1, 13))
|
||||
}
|
||||
}
|
||||
async function * f2() {
|
||||
>f2 : Symbol(f2, Decl(types.forAwait.es2017.1.ts, 12, 1))
|
||||
|
||||
let y: number;
|
||||
>y : Symbol(y, Decl(types.forAwait.es2017.1.ts, 14, 7))
|
||||
|
||||
for await (const x of asyncIterable) {
|
||||
>x : Symbol(x, Decl(types.forAwait.es2017.1.ts, 15, 20))
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.es2017.1.ts, 0, 13))
|
||||
}
|
||||
for await (const x of iterable) {
|
||||
>x : Symbol(x, Decl(types.forAwait.es2017.1.ts, 17, 20))
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.es2017.1.ts, 1, 13))
|
||||
}
|
||||
for await (y of asyncIterable) {
|
||||
>y : Symbol(y, Decl(types.forAwait.es2017.1.ts, 14, 7))
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.es2017.1.ts, 0, 13))
|
||||
}
|
||||
for await (y of iterable) {
|
||||
>y : Symbol(y, Decl(types.forAwait.es2017.1.ts, 14, 7))
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.es2017.1.ts, 1, 13))
|
||||
}
|
||||
}
|
||||
55
tests/baselines/reference/types.forAwait.esnext.1.symbols
Normal file
55
tests/baselines/reference/types.forAwait.esnext.1.symbols
Normal file
@ -0,0 +1,55 @@
|
||||
=== tests/cases/conformance/types/forAwait/types.forAwait.esnext.1.ts ===
|
||||
declare const asyncIterable: AsyncIterable<number>;
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13))
|
||||
>AsyncIterable : Symbol(AsyncIterable, Decl(lib.esnext.asynciterable.d.ts, --, --))
|
||||
|
||||
declare const iterable: Iterable<number>;
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13))
|
||||
>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
|
||||
async function f1() {
|
||||
>f1 : Symbol(f1, Decl(types.forAwait.esnext.1.ts, 1, 41))
|
||||
|
||||
let y: number;
|
||||
>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 3, 7))
|
||||
|
||||
for await (const x of asyncIterable) {
|
||||
>x : Symbol(x, Decl(types.forAwait.esnext.1.ts, 4, 20))
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13))
|
||||
}
|
||||
for await (const x of iterable) {
|
||||
>x : Symbol(x, Decl(types.forAwait.esnext.1.ts, 6, 20))
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13))
|
||||
}
|
||||
for await (y of asyncIterable) {
|
||||
>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 3, 7))
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13))
|
||||
}
|
||||
for await (y of iterable) {
|
||||
>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 3, 7))
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13))
|
||||
}
|
||||
}
|
||||
async function * f2() {
|
||||
>f2 : Symbol(f2, Decl(types.forAwait.esnext.1.ts, 12, 1))
|
||||
|
||||
let y: number;
|
||||
>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 14, 7))
|
||||
|
||||
for await (const x of asyncIterable) {
|
||||
>x : Symbol(x, Decl(types.forAwait.esnext.1.ts, 15, 20))
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13))
|
||||
}
|
||||
for await (const x of iterable) {
|
||||
>x : Symbol(x, Decl(types.forAwait.esnext.1.ts, 17, 20))
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13))
|
||||
}
|
||||
for await (y of asyncIterable) {
|
||||
>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 14, 7))
|
||||
>asyncIterable : Symbol(asyncIterable, Decl(types.forAwait.esnext.1.ts, 0, 13))
|
||||
}
|
||||
for await (y of iterable) {
|
||||
>y : Symbol(y, Decl(types.forAwait.esnext.1.ts, 14, 7))
|
||||
>iterable : Symbol(iterable, Decl(types.forAwait.esnext.1.ts, 1, 13))
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
=== tests/cases/conformance/types/forAwait/types.forAwait.es2017.1.ts ===
|
||||
=== tests/cases/conformance/types/forAwait/types.forAwait.esnext.1.ts ===
|
||||
declare const asyncIterable: AsyncIterable<number>;
|
||||
>asyncIterable : AsyncIterable<number>
|
||||
>AsyncIterable : AsyncIterable<T>
|
||||
@ -1,12 +1,12 @@
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.2.ts(6,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.2.ts(8,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.2.ts(10,16): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.2.ts(12,16): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.2.ts(14,21): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.2.ts(16,15): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(6,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(8,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(10,16): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(12,16): error TS2322: Type 'number' is not assignable to type 'string'.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(14,21): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts(16,15): error TS2488: Type must have a '[Symbol.iterator]()' method that returns an iterator.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/forAwait/types.forAwait.es2017.2.ts (6 errors) ====
|
||||
==== tests/cases/conformance/types/forAwait/types.forAwait.esnext.2.ts (6 errors) ====
|
||||
declare const asyncIterable: AsyncIterable<number>;
|
||||
declare const iterable: Iterable<number>;
|
||||
async function f() {
|
||||
@ -1,12 +1,12 @@
|
||||
error TS2318: Cannot find global type 'AsyncIterableIterator'.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.3.ts(3,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.3.ts(5,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.3.ts(10,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.es2017.3.ts(12,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts(3,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts(5,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts(10,27): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts(12,21): error TS2504: Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
|
||||
|
||||
|
||||
!!! error TS2318: Cannot find global type 'AsyncIterableIterator'.
|
||||
==== tests/cases/conformance/types/forAwait/types.forAwait.es2017.3.ts (4 errors) ====
|
||||
==== tests/cases/conformance/types/forAwait/types.forAwait.esnext.3.ts (4 errors) ====
|
||||
async function f1() {
|
||||
let y: number;
|
||||
for await (const x of {}) {
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2015
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: C1.ts
|
||||
class C1 {
|
||||
async * f() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2015
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: F1.ts
|
||||
async function * f1() {
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2015
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: F1.ts
|
||||
const f1 = async function * () {
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2015
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: O1.ts
|
||||
const o1 = {
|
||||
async * f() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2015
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: file1.ts
|
||||
async function f1() {
|
||||
let y: any;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es5
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: C1.ts
|
||||
class C1 {
|
||||
async * f() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es5
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: F1.ts
|
||||
async function * f1() {
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es5
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: F1.ts
|
||||
const f1 = async function * () {
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es5
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: O1.ts
|
||||
const o1 = {
|
||||
async * f() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es5
|
||||
// @lib: es2017
|
||||
// @lib: esnext
|
||||
// @filename: file1.ts
|
||||
async function f1() {
|
||||
let y: any;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @filename: C1.ts
|
||||
class C1 {
|
||||
async * f() {
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @filename: F1.ts
|
||||
async function * f1() {
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @filename: F1.ts
|
||||
const f1 = async function * () {
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @filename: O1.ts
|
||||
const o1 = {
|
||||
async * f() {
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2017
|
||||
// @lib: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @filename: file1.ts
|
||||
async function f1() {
|
||||
let y: any;
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
// @filename: methodIsOk.ts
|
||||
class C1 {
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
// @filename: functionDeclarationIsOk.ts
|
||||
async function * f1() {
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
// @filename: functionExpressionIsOk.ts
|
||||
const f1 = async function * f() {
|
||||
@ -1,4 +1,5 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
// @filename: methodIsOk.ts
|
||||
const o1 = {
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2017
|
||||
// @lib: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
// @filename: topLevelWithDeclIsError.ts
|
||||
for await (const x of y) {
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2017
|
||||
// @lib: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
async function * inferReturnType1() {
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2017
|
||||
// @lib: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
async function * inferReturnType1() {
|
||||
yield* {};
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2017
|
||||
// @lib: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
declare const asyncIterable: AsyncIterable<number>;
|
||||
declare const iterable: Iterable<number>;
|
||||
@ -1,5 +1,5 @@
|
||||
// @target: es2017
|
||||
// @lib: es2017
|
||||
// @target: esnext
|
||||
// @lib: esnext
|
||||
// @noEmit: true
|
||||
declare const asyncIterable: AsyncIterable<number>;
|
||||
declare const iterable: Iterable<number>;
|
||||
@ -1,4 +1,4 @@
|
||||
// @target: es2017
|
||||
// @target: esnext
|
||||
// @lib: es5
|
||||
// @noEmit: true
|
||||
async function f1() {
|
||||
Loading…
x
Reference in New Issue
Block a user