mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
[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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user