Merge pull request #4355 from DavidSouther/ts4354

Emits safe value for import.
This commit is contained in:
Mohamed Hegazy
2015-08-19 10:25:25 -07:00
5 changed files with 60 additions and 1 deletions

View File

@@ -240,7 +240,7 @@ namespace ts {
// Make an identifier from an external module name by extracting the string after the last "/" and replacing
// all non-alphanumeric characters with underscores
export function makeIdentifierFromModuleName(moduleName: string): string {
return getBaseFileName(moduleName).replace(/\W/g, "_");
return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_");
}
export function isBlockOrCatchScoped(declaration: Declaration) {