mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge pull request #9445 from Microsoft/export_default_async_function
Parse `export default async function` as a declaration
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -469,7 +469,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export interface ModifiersArray extends NodeArray<Modifier> {
|
||||
flags: number;
|
||||
flags: NodeFlags;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.AbstractKeyword)
|
||||
|
||||
Reference in New Issue
Block a user