mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Add tests
This commit is contained in:
committed by
Kanchalai Tanglertsampan
parent
7bd336d0c6
commit
b3c23643c6
@@ -3889,7 +3889,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
// We create a synthetic copy of the identifier in order to avoid the rewriting that might
|
||||
// otherwise occur when the identifier is emitted.
|
||||
index = <Identifier | LiteralExpression>createSynthesizedNode(propName.kind);
|
||||
(<Identifier | LiteralExpression>index).text = (<Identifier | LiteralExpression>propName).text;
|
||||
(<Identifier | LiteralExpression>index).text = unescapeIdentifier((<Identifier | LiteralExpression>propName).text);
|
||||
}
|
||||
|
||||
return !nameIsComputed && index.kind === SyntaxKind.Identifier
|
||||
|
||||
@@ -238,11 +238,10 @@ namespace ts {
|
||||
return identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
|
||||
// TODO(yuisu): comment
|
||||
export function escapeIdentifier(identifier: string): string {
|
||||
return prefixWithUnderscoreUnderscore(identifier)? "_" + identifier : identifier;
|
||||
return prefixWithUnderscoreUnderscore(identifier) ? "_" + identifier : identifier;
|
||||
}
|
||||
|
||||
// Remove extra underscore from escaped identifier
|
||||
|
||||
Reference in New Issue
Block a user