forked from OSchip/llvm-project
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
This commit is contained in:
parent
d0d29addf9
commit
79f9c5fe0c
|
@ -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;
|
||||
|
|
|
@ -1799,6 +1799,7 @@ TEST_F(FormatTestJS, NonNullAssertionOperator) {
|
|||
" .foo()!\n"
|
||||
" .foo()!;\n",
|
||||
getGoogleJSStyleWithColumns(20));
|
||||
verifyFormat("let x = namespace!;\n");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, Conditional) {
|
||||
|
|
Loading…
Reference in New Issue