[Transforms] fix Not correctly emitting local name for exported class (#8048)

* Fix 7864: by set emitFlags to not substitute the node

* Address PR: fix comment
This commit is contained in:
Yui
2016-04-14 09:27:08 -07:00
parent 86d7425adc
commit 2c95ea966c

View File

@@ -358,6 +358,9 @@ namespace ts {
return undefined;
}
// Set emitFlags on the name of the importEqualsDeclaration
// This is so the printer will not substitute the identifier
setNodeEmitFlags(node.name, NodeEmitFlags.NoSubstitution);
const statements: Statement[] = [];
if (moduleKind !== ModuleKind.AMD) {
if (hasModifier(node, ModifierFlags.Export)) {
@@ -639,6 +642,9 @@ namespace ts {
function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> {
const statements: Statement[] = [];
const name = node.name || getGeneratedNameForNode(node);
// Set emitFlags on the name of the classDeclaration
// This is so that when printer will not substitute the identifier
setNodeEmitFlags(name, NodeEmitFlags.NoSubstitution);
if (hasModifier(node, ModifierFlags.Export)) {
statements.push(
createClassDeclaration(
@@ -834,6 +840,9 @@ namespace ts {
// Find the name of the module alias, if there is one
const importAliasName = getLocalNameForExternalImport(importNode, currentSourceFile);
if (includeNonAmdDependencies && importAliasName) {
// Set emitFlags on the name of the classDeclaration
// This is so that when printer will not substitute the identifier
setNodeEmitFlags(importAliasName, NodeEmitFlags.NoSubstitution);
aliasedModuleNames.push(externalModuleName);
importAliasNames.push(createParameter(importAliasName));
}