mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 00:55:32 -05:00
Merge pull request #5641 from RyanCavanaugh/fix5634
Quote only names that need to be quoted, not the reverse
This commit is contained in:
@@ -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("\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user