Add tests

This commit is contained in:
Yui T
2015-12-21 15:45:58 -08:00
committed by Kanchalai Tanglertsampan
parent 7bd336d0c6
commit b3c23643c6
2 changed files with 3 additions and 4 deletions

View File

@@ -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

View File

@@ -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