mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
UMD support
This commit is contained in:
@@ -301,6 +301,9 @@ namespace ts {
|
||||
case SyntaxKind.ImportClause:
|
||||
return visitNode(cbNode, (<ImportClause>node).name) ||
|
||||
visitNode(cbNode, (<ImportClause>node).namedBindings);
|
||||
case SyntaxKind.GlobalModuleExportDeclaration:
|
||||
return visitNode(cbNode, (<GlobalModuleExportDeclaration>node).name);
|
||||
|
||||
case SyntaxKind.NamespaceImport:
|
||||
return visitNode(cbNode, (<NamespaceImport>node).name);
|
||||
case SyntaxKind.NamedImports:
|
||||
@@ -1125,7 +1128,7 @@ namespace ts {
|
||||
if (token === SyntaxKind.DefaultKeyword) {
|
||||
return lookAhead(nextTokenIsClassOrFunction);
|
||||
}
|
||||
return token !== SyntaxKind.AsteriskToken && token !== SyntaxKind.OpenBraceToken && canFollowModifier();
|
||||
return token !== SyntaxKind.AsteriskToken && token !== SyntaxKind.AsKeyword && token !== SyntaxKind.OpenBraceToken && canFollowModifier();
|
||||
}
|
||||
if (token === SyntaxKind.DefaultKeyword) {
|
||||
return nextTokenIsClassOrFunction();
|
||||
@@ -4400,7 +4403,8 @@ namespace ts {
|
||||
continue;
|
||||
|
||||
case SyntaxKind.GlobalKeyword:
|
||||
return nextToken() === SyntaxKind.OpenBraceToken;
|
||||
nextToken();
|
||||
return token === SyntaxKind.OpenBraceToken || token === SyntaxKind.Identifier || token === SyntaxKind.ExportKeyword;
|
||||
|
||||
case SyntaxKind.ImportKeyword:
|
||||
nextToken();
|
||||
@@ -4409,7 +4413,8 @@ namespace ts {
|
||||
case SyntaxKind.ExportKeyword:
|
||||
nextToken();
|
||||
if (token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken ||
|
||||
token === SyntaxKind.OpenBraceToken || token === SyntaxKind.DefaultKeyword) {
|
||||
token === SyntaxKind.OpenBraceToken || token === SyntaxKind.DefaultKeyword ||
|
||||
token === SyntaxKind.AsKeyword) {
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
@@ -4586,6 +4591,7 @@ namespace ts {
|
||||
case SyntaxKind.EnumKeyword:
|
||||
return parseEnumDeclaration(fullStart, decorators, modifiers);
|
||||
case SyntaxKind.GlobalKeyword:
|
||||
return parseModuleDeclaration(fullStart, decorators, modifiers);
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.NamespaceKeyword:
|
||||
return parseModuleDeclaration(fullStart, decorators, modifiers);
|
||||
@@ -4593,9 +4599,15 @@ namespace ts {
|
||||
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
|
||||
case SyntaxKind.ExportKeyword:
|
||||
nextToken();
|
||||
return token === SyntaxKind.DefaultKeyword || token === SyntaxKind.EqualsToken ?
|
||||
parseExportAssignment(fullStart, decorators, modifiers) :
|
||||
parseExportDeclaration(fullStart, decorators, modifiers);
|
||||
switch (token) {
|
||||
case SyntaxKind.DefaultKeyword:
|
||||
case SyntaxKind.EqualsToken:
|
||||
return parseExportAssignment(fullStart, decorators, modifiers);
|
||||
case SyntaxKind.AsKeyword:
|
||||
return parseGlobalModuleExportDeclaration(fullStart, decorators, modifiers);
|
||||
default:
|
||||
return parseExportDeclaration(fullStart, decorators, modifiers);
|
||||
}
|
||||
default:
|
||||
if (decorators || modifiers) {
|
||||
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
|
||||
@@ -5264,6 +5276,20 @@ namespace ts {
|
||||
return nextToken() === SyntaxKind.SlashToken;
|
||||
}
|
||||
|
||||
function parseGlobalModuleExportDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): GlobalModuleExportDeclaration {
|
||||
const exportDeclaration = <GlobalModuleExportDeclaration>createNode(SyntaxKind.GlobalModuleExportDeclaration, fullStart);
|
||||
exportDeclaration.decorators = decorators;
|
||||
exportDeclaration.modifiers = modifiers;
|
||||
parseExpected(SyntaxKind.AsKeyword);
|
||||
parseExpected(SyntaxKind.NamespaceKeyword);
|
||||
|
||||
exportDeclaration.name = parseIdentifier();
|
||||
|
||||
parseExpected(SyntaxKind.SemicolonToken);
|
||||
|
||||
return finishNode(exportDeclaration);
|
||||
}
|
||||
|
||||
function parseImportDeclarationOrImportEqualsDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ImportEqualsDeclaration | ImportDeclaration {
|
||||
parseExpected(SyntaxKind.ImportKeyword);
|
||||
const afterImportPos = scanner.getStartPos();
|
||||
|
||||
Reference in New Issue
Block a user