@@ -112,26 +112,22 @@ namespace ts {
112112                            // export * as ns from "mod" 
113113                            // export { x, y } from "mod" 
114114                            externalImports . push ( < ExportDeclaration > node ) ; 
115+                             if  ( isNamedExports ( ( node  as  ExportDeclaration ) . exportClause ! ) )  { 
116+                                 addExportedNamesForExportDeclaration ( node  as  ExportDeclaration ) ; 
117+                             } 
118+                             else  { 
119+                                 const  name  =  ( ( node  as  ExportDeclaration ) . exportClause  as  NamespaceExport ) . name ; 
120+                                 if  ( ! uniqueExports . get ( idText ( name ) ) )  { 
121+                                     multiMapSparseArrayAdd ( exportedBindings ,  getOriginalNodeId ( node ) ,  name ) ; 
122+                                     uniqueExports . set ( idText ( name ) ,  true ) ; 
123+                                     exportedNames  =  append ( exportedNames ,  name ) ; 
124+                                 } 
125+                             } 
115126                        } 
116127                    } 
117128                    else  { 
118129                        // export { x, y } 
119-                         for  ( const  specifier  of  cast ( ( < ExportDeclaration > node ) . exportClause ,  isNamedExports ) . elements )  { 
120-                             if  ( ! uniqueExports . get ( idText ( specifier . name ) ) )  { 
121-                                 const  name  =  specifier . propertyName  ||  specifier . name ; 
122-                                 exportSpecifiers . add ( idText ( name ) ,  specifier ) ; 
123- 
124-                                 const  decl  =  resolver . getReferencedImportDeclaration ( name ) 
125-                                     ||  resolver . getReferencedValueDeclaration ( name ) ; 
126- 
127-                                 if  ( decl )  { 
128-                                     multiMapSparseArrayAdd ( exportedBindings ,  getOriginalNodeId ( decl ) ,  specifier . name ) ; 
129-                                 } 
130- 
131-                                 uniqueExports . set ( idText ( specifier . name ) ,  true ) ; 
132-                                 exportedNames  =  append ( exportedNames ,  specifier . name ) ; 
133-                             } 
134-                         } 
130+                         addExportedNamesForExportDeclaration ( node  as  ExportDeclaration ) ; 
135131                    } 
136132                    break ; 
137133
@@ -200,6 +196,25 @@ namespace ts {
200196        } 
201197
202198        return  {  externalImports,  exportSpecifiers,  exportEquals,  hasExportStarsToExportValues,  exportedBindings,  exportedNames,  externalHelpersImportDeclaration } ; 
199+ 
200+         function  addExportedNamesForExportDeclaration ( node : ExportDeclaration )  { 
201+             for  ( const  specifier  of  cast ( node . exportClause ,  isNamedExports ) . elements )  { 
202+                 if  ( ! uniqueExports . get ( idText ( specifier . name ) ) )  { 
203+                     const  name  =  specifier . propertyName  ||  specifier . name ; 
204+                     exportSpecifiers . add ( idText ( name ) ,  specifier ) ; 
205+ 
206+                     const  decl  =  resolver . getReferencedImportDeclaration ( name ) 
207+                         ||  resolver . getReferencedValueDeclaration ( name ) ; 
208+ 
209+                     if  ( decl )  { 
210+                         multiMapSparseArrayAdd ( exportedBindings ,  getOriginalNodeId ( decl ) ,  specifier . name ) ; 
211+                     } 
212+ 
213+                     uniqueExports . set ( idText ( specifier . name ) ,  true ) ; 
214+                     exportedNames  =  append ( exportedNames ,  specifier . name ) ; 
215+                 } 
216+             } 
217+         } 
203218    } 
204219
205220    function  collectExportedVariableInfo ( decl : VariableDeclaration  |  BindingElement ,  uniqueExports : Map < boolean > ,  exportedNames : Identifier [ ]  |  undefined )  { 
0 commit comments