Merge pull request #5641 from RyanCavanaugh/fix5634

Quote only names that need to be quoted, not the reverse
This commit is contained in:
Ryan Cavanaugh
2015-11-12 15:05:33 -08:00
7 changed files with 113 additions and 8 deletions

View File

@@ -1592,13 +1592,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
/// these emit into an object literal property name, we don't need to be worried
/// about keywords, just non-identifier characters
function emitAttributeName(name: Identifier) {
if (/[A-Za-z_]+[\w*]/.test(name.text)) {
write("\"");
if (/^[A-Za-z_]\w*$/.test(name.text)) {
emit(name);
write("\"");
}
else {
write("\"");
emit(name);
write("\"");
}
}