@@ -905,7 +905,7 @@ module ts {
905905 }
906906 else {
907907 write ( "{ " ) ;
908- emitCommaList ( ( < NamedImports > node . importClause . namedBindings ) . elements , emitImportSpecifier , resolver . isDeclarationVisible ) ;
908+ emitCommaList ( ( < NamedImports > node . importClause . namedBindings ) . elements , emitImportOrExportSpecifier , resolver . isDeclarationVisible ) ;
909909 write ( " }" ) ;
910910 }
911911 }
@@ -916,14 +916,43 @@ module ts {
916916 writer . writeLine ( ) ;
917917 }
918918
919- function emitImportSpecifier ( node : ImportSpecifier ) {
919+ function emitImportOrExportSpecifier ( node : ImportOrExportSpecifier ) {
920920 if ( node . propertyName ) {
921921 writeTextOfNode ( currentSourceFile , node . propertyName ) ;
922922 write ( " as " ) ;
923923 }
924924 writeTextOfNode ( currentSourceFile , node . name ) ;
925925 }
926926
927+ function emitExportSpecifier ( node : ExportSpecifier ) {
928+ emitImportOrExportSpecifier ( node ) ;
929+
930+ // Make all the declarations visible for the export name
931+ var nodes = resolver . setDeclarationsOfIdentifierAsVisible ( node . propertyName || node . name ) ;
932+
933+ // write each of these declarations asynchronously
934+ writeAsynchronousModuleElements ( nodes ) ;
935+ }
936+
937+ function emitExportDeclaration ( node : ExportDeclaration ) {
938+ emitJsDocComments ( node ) ;
939+ write ( "export " ) ;
940+ if ( node . exportClause ) {
941+ write ( "{ " ) ;
942+ emitCommaList ( node . exportClause . elements , emitExportSpecifier ) ;
943+ write ( " }" ) ;
944+ }
945+ else {
946+ write ( "*" ) ;
947+ }
948+ if ( node . moduleSpecifier ) {
949+ write ( " from " ) ;
950+ writeTextOfNode ( currentSourceFile , node . moduleSpecifier ) ;
951+ }
952+ write ( ";" ) ;
953+ writer . writeLine ( ) ;
954+ }
955+
927956 function writeModuleDeclaration ( node : ModuleDeclaration ) {
928957 emitJsDocComments ( node ) ;
929958 emitModuleElementDeclarationFlags ( node ) ;
@@ -1608,6 +1637,8 @@ module ts {
16081637 case SyntaxKind . ImportDeclaration :
16091638 // Import declaration without import clause is visible, otherwise it is not visible
16101639 return emitModuleElement ( node , /*isModuleElementVisible*/ ! ( < ImportDeclaration > node ) . importClause ) ;
1640+ case SyntaxKind . ExportDeclaration :
1641+ return emitExportDeclaration ( < ExportDeclaration > node ) ;
16111642 case SyntaxKind . Constructor :
16121643 case SyntaxKind . MethodDeclaration :
16131644 case SyntaxKind . MethodSignature :
0 commit comments