fix ES6 emit for namespaces to only emit one export binding

This commit is contained in:
Wesley Wigham 2015-11-23 12:43:28 -08:00
parent d0fc3948b5
commit 6a8e78cdc0
2 changed files with 11 additions and 9 deletions

View File

@ -6318,15 +6318,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
const emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node);
if (emitVarForModule) {
emitStart(node);
if (isES6ExportedDeclaration(node)) {
write("export ");
const isES6ExportedNamespace = isES6ExportedDeclaration(node);
if ((!isES6ExportedNamespace) || !forEach(node.symbol && node.symbol.declarations, declaration => declaration.kind === SyntaxKind.ModuleDeclaration && declaration.pos < node.pos)) {
emitStart(node);
if (isES6ExportedNamespace) {
write("export ");
}
write("var ");
emit(node.name);
write(";");
emitEnd(node);
writeLine();
}
write("var ");
emit(node.name);
write(";");
emitEnd(node);
writeLine();
}
emitStart(node);

View File

@ -58,7 +58,6 @@ export var M;
// alias
M.M_A = M_M;
})(M || (M = {}));
export var M;
(function (M) {
// Reexports
export { M_V as v };