Merge pull request #9445 from Microsoft/export_default_async_function

Parse `export default async function` as a declaration
This commit is contained in:
Andy
2016-06-30 13:55:24 -07:00
committed by GitHub
6 changed files with 44 additions and 6 deletions

View File

@@ -1155,12 +1155,12 @@ namespace ts {
if (token === SyntaxKind.ExportKeyword) {
nextToken();
if (token === SyntaxKind.DefaultKeyword) {
return lookAhead(nextTokenIsClassOrFunction);
return lookAhead(nextTokenIsClassOrFunctionOrAsync);
}
return token !== SyntaxKind.AsteriskToken && token !== SyntaxKind.AsKeyword && token !== SyntaxKind.OpenBraceToken && canFollowModifier();
}
if (token === SyntaxKind.DefaultKeyword) {
return nextTokenIsClassOrFunction();
return nextTokenIsClassOrFunctionOrAsync();
}
if (token === SyntaxKind.StaticKeyword) {
nextToken();
@@ -1182,9 +1182,9 @@ namespace ts {
|| isLiteralPropertyName();
}
function nextTokenIsClassOrFunction(): boolean {
function nextTokenIsClassOrFunctionOrAsync(): boolean {
nextToken();
return token === SyntaxKind.ClassKeyword || token === SyntaxKind.FunctionKeyword;
return token === SyntaxKind.ClassKeyword || token === SyntaxKind.FunctionKeyword || token === SyntaxKind.AsyncKeyword;
}
// True if positioned at the start of a list element
@@ -5070,7 +5070,7 @@ namespace ts {
* In such situations, 'permitInvalidConstAsModifier' should be set to true.
*/
function parseModifiers(permitInvalidConstAsModifier?: boolean): ModifiersArray {
let flags = 0;
let flags: NodeFlags = 0;
let modifiers: ModifiersArray;
while (true) {
const modifierStart = scanner.getStartPos();

View File

@@ -469,7 +469,7 @@ namespace ts {
}
export interface ModifiersArray extends NodeArray<Modifier> {
flags: number;
flags: NodeFlags;
}
// @kind(SyntaxKind.AbstractKeyword)