Skip to content

Commit b3c2364

Browse files
author
Yui T
committed
Add tests
1 parent 7bd336d commit b3c2364

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/compiler/emitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3889,7 +3889,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
38893889
// We create a synthetic copy of the identifier in order to avoid the rewriting that might
38903890
// otherwise occur when the identifier is emitted.
38913891
index = <Identifier | LiteralExpression>createSynthesizedNode(propName.kind);
3892-
(<Identifier | LiteralExpression>index).text = (<Identifier | LiteralExpression>propName).text;
3892+
(<Identifier | LiteralExpression>index).text = unescapeIdentifier((<Identifier | LiteralExpression>propName).text);
38933893
}
38943894

38953895
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)