Emit 'exports.' if the shorthand is a general export.

This commit is contained in:
Daniel Rosenwasser 2016-06-13 23:33:47 -07:00
parent d54094c6f7
commit eae289c7b7

View file

@ -2150,9 +2150,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}
// Return true if identifier resolves to an exported member of a namespace
function isNamespaceExportReference(node: Identifier) {
function isExportReference(node: Identifier) {
const container = resolver.getReferencedExportContainer(node);
return container && container.kind !== SyntaxKind.SourceFile;
return !!container;
}
// Return true if identifier resolves to an imported identifier
@ -2185,10 +2185,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
// const foo_1 = require('./foo');
// exports.baz = { foo: foo_1.foo };
//
if (languageVersion < ScriptTarget.ES6 || (modulekind !== ModuleKind.ES6 && isImportedReference(node.name)) || isNamespaceExportReference(node.name) ) {
if (languageVersion < ScriptTarget.ES6 || (modulekind !== ModuleKind.ES6 && isImportedReference(node.name)) || isExportReference(node.name)) {
// Emit identifier as an identifier
write(": ");
emit(node.name);
emitExpressionIdentifier(node.name);
}
if (languageVersion >= ScriptTarget.ES6 && node.objectAssignmentInitializer) {