From b499a03416b1dcf00a236f4572952bfa3fc1bc43 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Sun, 10 Jan 2016 18:01:40 -0800 Subject: [PATCH] Address PR --- src/compiler/utilities.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 818b24ca8fd..8f1c05adabe 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -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