From aa01dcd1a341480c643987f318543c8417bdff0c Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 24 Mar 2015 22:20:42 -0700 Subject: [PATCH] Move es6 alias name handeling to getAliasNameSubstitution to match getExportNameSubstitution --- src/compiler/checker.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bd993d0217f..90f13e2c96c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11128,6 +11128,12 @@ module ts { } function getAliasNameSubstitution(symbol: Symbol): string { + // If this is es6 or higher, just use the name of the export + // no need to qualify it. + if (languageVersion >= ScriptTarget.ES6) { + return undefined; + } + let node = getDeclarationOfAliasSymbol(symbol); if (node) { if (node.kind === SyntaxKind.ImportClause) { @@ -11143,15 +11149,12 @@ module ts { function getExportNameSubstitution(symbol: Symbol, location: Node): string { if (isExternalModuleSymbol(symbol.parent)) { - var symbolName = unescapeIdentifier(symbol.name); // If this is es6 or higher, just use the name of the export // no need to qualify it. if (languageVersion >= ScriptTarget.ES6) { return undefined; } - else { - return "exports." + symbolName; - } + return "exports." + unescapeIdentifier(symbol.name); } let node = location; let containerSymbol = getParentOfSymbol(symbol); @@ -11179,7 +11182,7 @@ module ts { return getExportNameSubstitution(exportSymbol, node.parent); } // Named imports from ES6 import declarations are rewritten - if (symbol.flags & SymbolFlags.Alias && languageVersion < ScriptTarget.ES6) { + if (symbol.flags & SymbolFlags.Alias) { return getAliasNameSubstitution(symbol); } }