@@ -802,6 +802,11 @@ module ts {
802802 case SyntaxKind . EnumDeclaration :
803803 case SyntaxKind . ModuleDeclaration :
804804 case SyntaxKind . ImportEqualsDeclaration :
805+ case SyntaxKind . ExportSpecifier :
806+ case SyntaxKind . ImportSpecifier :
807+ case SyntaxKind . ImportEqualsDeclaration :
808+ case SyntaxKind . ImportClause :
809+ case SyntaxKind . NamespaceImport :
805810 case SyntaxKind . GetAccessor :
806811 case SyntaxKind . SetAccessor :
807812 case SyntaxKind . TypeLiteral :
@@ -841,6 +846,37 @@ module ts {
841846 case SyntaxKind . PropertySignature :
842847 namedDeclarations . push ( < Declaration > node ) ;
843848 break ;
849+
850+ case SyntaxKind . ExportDeclaration :
851+ // Handle named exports case e.g.:
852+ // export {a, b as B} from "mod";
853+ if ( ( < ExportDeclaration > node ) . exportClause ) {
854+ forEach ( ( < ExportDeclaration > node ) . exportClause . elements , visit ) ;
855+ }
856+ break ;
857+
858+ case SyntaxKind . ImportDeclaration :
859+ var importClause = ( < ImportDeclaration > node ) . importClause ;
860+ if ( importClause ) {
861+ // Handle default import case e.g.:
862+ // import d from "mod";
863+ if ( importClause . name ) {
864+ namedDeclarations . push ( importClause ) ;
865+ }
866+
867+ // Handle named bindings in imports e.g.:
868+ // import * as NS from "mod";
869+ // import {a, b as B} from "mod";
870+ if ( importClause . namedBindings ) {
871+ if ( importClause . namedBindings . kind === SyntaxKind . NamespaceImport ) {
872+ namedDeclarations . push ( < NamespaceImport > importClause . namedBindings ) ;
873+ }
874+ else {
875+ forEach ( ( < NamedImports > importClause . namedBindings ) . elements , visit ) ;
876+ }
877+ }
878+ }
879+ break ;
844880 }
845881 } ) ;
846882
@@ -2010,6 +2046,12 @@ module ts {
20102046 case SyntaxKind . TypeParameter : return ScriptElementKind . typeParameterElement ;
20112047 case SyntaxKind . EnumMember : return ScriptElementKind . variableElement ;
20122048 case SyntaxKind . Parameter : return ( node . flags & NodeFlags . AccessibilityModifier ) ? ScriptElementKind . memberVariableElement : ScriptElementKind . parameterElement ;
2049+ case SyntaxKind . ImportEqualsDeclaration :
2050+ case SyntaxKind . ImportSpecifier :
2051+ case SyntaxKind . ImportClause :
2052+ case SyntaxKind . ExportSpecifier :
2053+ case SyntaxKind . NamespaceImport :
2054+ return ScriptElementKind . alias ;
20132055 }
20142056 return ScriptElementKind . unknown ;
20152057 }
0 commit comments