Skip to content

Commit

Permalink
Merge pull request #2123 from Microsoft/fixExportStarMerging
Browse files Browse the repository at this point in the history
Fix export * merging to not overwrite original members
  • Loading branch information
ahejlsberg committed Feb 24, 2015
2 parents 1b7dea0 + c46bdd6 commit a0eff60
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit a0eff60

Please sign in to comment.