From c46bdd66d3347b3c2dedec8267dfcdf7da24a40d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 23 Feb 2015 17:12:36 -0800 Subject: [PATCH] Fix export * merging to not overwrite original members --- src/compiler/checker.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index acb90c4767be3..5c371e7a34468 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -727,24 +727,24 @@ module ts { return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports; } - function getExportsOfModule(symbol: Symbol): SymbolTable { - var links = getSymbolLinks(symbol); - return links.resolvedExports || (links.resolvedExports = getExportsForModule(symbol)); + function getExportsOfModule(moduleSymbol: Symbol): SymbolTable { + var links = getSymbolLinks(moduleSymbol); + return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } - function getExportsForModule(symbol: Symbol): SymbolTable { + function getExportsForModule(moduleSymbol: Symbol): SymbolTable { var result: SymbolTable; var visitedSymbols: Symbol[] = []; - visit(symbol); - return result; + visit(moduleSymbol); + return result || moduleSymbol.exports; function visit(symbol: Symbol) { if (!contains(visitedSymbols, symbol)) { visitedSymbols.push(symbol); - if (!result) { - result = symbol.exports; - } - else { + if (symbol !== moduleSymbol) { + if (!result) { + result = cloneSymbolTable(moduleSymbol.exports); + } extendSymbolTable(result, symbol.exports); } forEach(symbol.declarations, node => {