Address PR

This commit is contained in:
Kanchalai Tanglertsampan
2016-01-10 18:01:40 -08:00
parent 540ae01015
commit b499a03416

View File

@@ -232,8 +232,8 @@ namespace ts {
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
export function escapeIdentifier(identifier: string): string {
const prefixWithUnderscore = identifier.length > 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._;
return prefixWithUnderscore ? "_" + identifier : identifier;
const prefixedWithUnderscores = identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._;
return prefixedWithUnderscores ? "_" + identifier : identifier;
}
// Remove extra underscore from escaped identifier