@@ -4527,6 +4527,8 @@ module ts {
45274527
45284528 function parseImportDeclarationOrImportEqualsDeclaration ( fullStart : number , modifiers : ModifiersArray ) : ImportEqualsDeclaration | ImportDeclaration {
45294529 parseExpected ( SyntaxKind . ImportKeyword ) ;
4530+ var afterImportPos = scanner . getStartPos ( ) ;
4531+
45304532 var identifier : Identifier ;
45314533 if ( isIdentifier ( ) ) {
45324534 identifier = parseIdentifier ( ) ;
@@ -4554,28 +4556,7 @@ module ts {
45544556 if ( identifier || // import id
45554557 token === SyntaxKind . AsteriskToken || // import *
45564558 token === SyntaxKind . OpenBraceToken ) { // import {
4557- //ImportClause:
4558- // ImportedDefaultBinding
4559- // NameSpaceImport
4560- // NamedImports
4561- // ImportedDefaultBinding, NameSpaceImport
4562- // ImportedDefaultBinding, NamedImports
4563-
4564- var importClause = < ImportClause > createNode ( SyntaxKind . ImportClause ) ;
4565- if ( identifier ) {
4566- // ImportedDefaultBinding:
4567- // ImportedBinding
4568- importClause . name = identifier ;
4569- }
4570-
4571- // If there was no default import or if there is comma token after default import
4572- // parse namespace or named imports
4573- if ( ! importClause . name ||
4574- parseOptional ( SyntaxKind . CommaToken ) ) {
4575- importClause . namedBindings = token === SyntaxKind . AsteriskToken ? parseNamespaceImport ( ) : parseNamedImports ( ) ;
4576- }
4577-
4578- importDeclaration . importClause = finishNode ( importClause ) ;
4559+ importDeclaration . importClause = parseImportClause ( identifier , afterImportPos ) ;
45794560 parseExpected ( SyntaxKind . FromKeyword ) ;
45804561 }
45814562
@@ -4584,6 +4565,31 @@ module ts {
45844565 return finishNode ( importDeclaration ) ;
45854566 }
45864567
4568+ function parseImportClause ( identifier : Identifier , fullStart : number ) {
4569+ //ImportClause:
4570+ // ImportedDefaultBinding
4571+ // NameSpaceImport
4572+ // NamedImports
4573+ // ImportedDefaultBinding, NameSpaceImport
4574+ // ImportedDefaultBinding, NamedImports
4575+
4576+ var importClause = < ImportClause > createNode ( SyntaxKind . ImportClause , fullStart ) ;
4577+ if ( identifier ) {
4578+ // ImportedDefaultBinding:
4579+ // ImportedBinding
4580+ importClause . name = identifier ;
4581+ }
4582+
4583+ // If there was no default import or if there is comma token after default import
4584+ // parse namespace or named imports
4585+ if ( ! importClause . name ||
4586+ parseOptional ( SyntaxKind . CommaToken ) ) {
4587+ importClause . namedBindings = token === SyntaxKind . AsteriskToken ? parseNamespaceImport ( ) : parseNamedImports ( ) ;
4588+ }
4589+
4590+ return finishNode ( importClause ) ;
4591+ }
4592+
45874593 function parseModuleReference ( ) {
45884594 return isExternalModuleReference ( )
45894595 ? parseExternalModuleReference ( )
0 commit comments