diff options
author | Martin Probst <martin@probst.io> | 2017-05-15 08:15:53 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2017-05-15 08:15:53 +0000 |
commit | 82b3d906bc2e141525b3e3e5dd24e60f5511de07 (patch) | |
tree | c685b37754390dac9364f17846a9fbb161a6602f /clang/lib/Format/TokenAnnotator.cpp | |
parent | 89f9ad8636c672eb26e881f0f9f31f7de8c303a0 (diff) | |
download | bcm5719-llvm-82b3d906bc2e141525b3e3e5dd24e60f5511de07.tar.gz bcm5719-llvm-82b3d906bc2e141525b3e3e5dd24e60f5511de07.zip |
clang-format: [JS] fix non-null assertion operator recognition.
Summary:
`getIdentifierInfo()` includes all keywords, whereas non-null assertion
operators should only be recognized after non-keywords or pseudo keywords.
Ideally this should list all tokens that clang-format recognizes as a keyword,
but that are pseudo or no keywords in JS. For the time being, just recognize
the specific bits users ran into (`namespace` in this case).
Reviewers: djasper
Subscribers: klimek
Differential Revision: https://reviews.llvm.org/D33182
llvm-svn: 303038
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index d3b2cf4e84c..bd5e2ed2f41 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1034,9 +1034,9 @@ private: if (Style.Language == FormatStyle::LK_JavaScript) { if (Current.is(tok::exclaim)) { if (Current.Previous && - (Current.Previous->Tok.getIdentifierInfo() || - Current.Previous->isOneOf(tok::identifier, tok::r_paren, - tok::r_square, tok::r_brace) || + (Current.Previous->isOneOf(tok::identifier, tok::kw_namespace, + tok::r_paren, tok::r_square, + tok::r_brace) || Current.Previous->Tok.isLiteral())) { Current.Type = TT_JsNonNullAssertion; return; |