summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2017-05-12 13:00:33 +0000
committerMartin Probst <martin@probst.io>2017-05-12 13:00:33 +0000
commit79f9c5fe0c837858c343e1bcb9d36ffd44374f1f (patch)
treeb5abf5704b3234c6061013c0856a749824832771 /clang/lib/Format
parentd0d29addf9e9e54aeb8322d7fe47fa2bee4f3b14 (diff)
downloadbcm5719-llvm-79f9c5fe0c837858c343e1bcb9d36ffd44374f1f.tar.gz
bcm5719-llvm-79f9c5fe0c837858c343e1bcb9d36ffd44374f1f.zip
clang-format: [JS] support non-null assertions after all identifiers.
Summary: Previously: x = namespace !; Now: x = namespace!; Reviewers: djasper Subscribers: klimek Differential Revision: https://reviews.llvm.org/D33113 llvm-svn: 302893
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 c274d7bf07f..d3b2cf4e84c 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1034,7 +1034,8 @@ private:
if (Style.Language == FormatStyle::LK_JavaScript) {
if (Current.is(tok::exclaim)) {
if (Current.Previous &&
- (Current.Previous->isOneOf(tok::identifier, tok::r_paren,
+ (Current.Previous->Tok.getIdentifierInfo() ||
+ Current.Previous->isOneOf(tok::identifier, tok::r_paren,
tok::r_square, tok::r_brace) ||
Current.Previous->Tok.isLiteral())) {
Current.Type = TT_JsNonNullAssertion;
OpenPOWER on IntegriCloud