From 2c95ea966cb347373b033c557855d40deca9da17 Mon Sep 17 00:00:00 2001 From: Yui Date: Thu, 14 Apr 2016 09:27:08 -0700 Subject: [PATCH] [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 --- src/compiler/transformers/module/module.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 9d7dc0b2a82..563733a9c97 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -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 { 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)); }