From 981ef7f0eba6258e796ff33368e1c968f50aabe9 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 4 Mar 2015 14:53:44 -0800 Subject: [PATCH] Excluding "default" member from "export *" per ES6 specification --- src/compiler/checker.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 8e2b3b465e4..1996fc6ab1f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -248,14 +248,6 @@ module ts { } } - function extendSymbolTable(target: SymbolTable, source: SymbolTable) { - for (var id in source) { - if (!hasProperty(target, id)) { - target[id] = source[id]; - } - } - } - function getSymbolLinks(symbol: Symbol): SymbolLinks { if (symbol.flags & SymbolFlags.Transient) return symbol; if (!symbol.id) symbol.id = nextSymbolId++; @@ -723,6 +715,14 @@ module ts { return links.resolvedExports || (links.resolvedExports = getExportsForModule(moduleSymbol)); } + function extendExportSymbols(target: SymbolTable, source: SymbolTable) { + for (var id in source) { + if (id !== "default" && !hasProperty(target, id)) { + target[id] = source[id]; + } + } + } + function getExportsForModule(moduleSymbol: Symbol): SymbolTable { if (compilerOptions.target < ScriptTarget.ES6) { // A default export hides all other exports in CommonJS and AMD modules @@ -747,7 +747,7 @@ module ts { if (!result) { result = cloneSymbolTable(moduleSymbol.exports); } - extendSymbolTable(result, symbol.exports); + extendExportSymbols(result, symbol.exports); } // All export * declarations are collected in an __export symbol by the binder var exportStars = symbol.exports["__export"];