Skip to content

Commit a034314

Browse files
author
Yui T
committed
Add tests
1 parent cabe1d6 commit a034314

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/compiler/emitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3848,7 +3848,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
38483848
// We create a synthetic copy of the identifier in order to avoid the rewriting that might
38493849
// otherwise occur when the identifier is emitted.
38503850
index = <Identifier | LiteralExpression>createSynthesizedNode(propName.kind);
3851-
(<Identifier | LiteralExpression>index).text = (<Identifier | LiteralExpression>propName).text;
3851+
(<Identifier | LiteralExpression>index).text = unescapeIdentifier((<Identifier | LiteralExpression>propName).text);
38523852
}
38533853

38543854
return !nameIsComputed && index.kind === SyntaxKind.Identifier

src/compiler/utilities.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,10 @@ namespace ts {
238238
return identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? true : false;
239239
}
240240
}
241-
241+
242242
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
243-
// TODO(yuisu): comment
244243
export function escapeIdentifier(identifier: string): string {
245-
return prefixWithUnderscoreUnderscore(identifier)? "_" + identifier : identifier;
244+
return prefixWithUnderscoreUnderscore(identifier) ? "_" + identifier : identifier;
246245
}
247246

248247
// Remove extra underscore from escaped identifier

0 commit comments

Comments
 (0)