summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-03-01 04:19:47 +0000
committerDaniel Jasper <djasper@google.com>2016-03-01 04:19:47 +0000
commitb18425bf96b1b8d4b21cf1827bda5fde6a91df3a (patch)
tree6299e9452c1817e5b2c2081aee7b6273a45b7f71 /clang/lib/Format
parentd7511c8a2201af8d41b6107c8aa4e25b9b2e2f64 (diff)
downloadbcm5719-llvm-b18425bf96b1b8d4b21cf1827bda5fde6a91df3a.tar.gz
bcm5719-llvm-b18425bf96b1b8d4b21cf1827bda5fde6a91df3a.zip
clang-format: [JS] Support quoted object literal keys.
Before: var x = { a: a, b: b, 'c': c, }; After: var x = { a: a, b: b, 'c': c, }; llvm-svn: 262291
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 591ac5c4719..ea869307289 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -409,7 +409,8 @@ private:
(!Contexts.back().ColonIsDictLiteral ||
Style.Language != FormatStyle::LK_Cpp)) ||
Style.Language == FormatStyle::LK_Proto) &&
- Previous->Tok.getIdentifierInfo())
+ (Previous->Tok.getIdentifierInfo() ||
+ Previous->is(tok::char_constant)))
Previous->Type = TT_SelectorName;
if (CurrentToken->is(tok::colon) ||
Style.Language == FormatStyle::LK_JavaScript)
OpenPOWER on IntegriCloud