Skip to content

Commit aa01dcd

Browse files
committed
Move es6 alias name handeling to getAliasNameSubstitution to match getExportNameSubstitution
1 parent bc51dd1 commit aa01dcd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/compiler/checker.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11128,6 +11128,12 @@ module ts {
1112811128
}
1112911129

1113011130
function getAliasNameSubstitution(symbol: Symbol): string {
11131+
// If this is es6 or higher, just use the name of the export
11132+
// no need to qualify it.
11133+
if (languageVersion >= ScriptTarget.ES6) {
11134+
return undefined;
11135+
}
11136+
1113111137
let node = getDeclarationOfAliasSymbol(symbol);
1113211138
if (node) {
1113311139
if (node.kind === SyntaxKind.ImportClause) {
@@ -11143,15 +11149,12 @@ module ts {
1114311149

1114411150
function getExportNameSubstitution(symbol: Symbol, location: Node): string {
1114511151
if (isExternalModuleSymbol(symbol.parent)) {
11146-
var symbolName = unescapeIdentifier(symbol.name);
1114711152
// If this is es6 or higher, just use the name of the export
1114811153
// no need to qualify it.
1114911154
if (languageVersion >= ScriptTarget.ES6) {
1115011155
return undefined;
1115111156
}
11152-
else {
11153-
return "exports." + symbolName;
11154-
}
11157+
return "exports." + unescapeIdentifier(symbol.name);
1115511158
}
1115611159
let node = location;
1115711160
let containerSymbol = getParentOfSymbol(symbol);
@@ -11179,7 +11182,7 @@ module ts {
1117911182
return getExportNameSubstitution(exportSymbol, node.parent);
1118011183
}
1118111184
// Named imports from ES6 import declarations are rewritten
11182-
if (symbol.flags & SymbolFlags.Alias && languageVersion < ScriptTarget.ES6) {
11185+
if (symbol.flags & SymbolFlags.Alias) {
1118311186
return getAliasNameSubstitution(symbol);
1118411187
}
1118511188
}

0 commit comments

Comments
 (0)