forked from OSchip/llvm-project
clang-format: In Java, `assert` is followed by an expression.
Before: assert a&& b; Now: assert a && b; llvm-svn: 247750
This commit is contained in:
parent
8a5526e8be
commit
4f11349028
|
@ -539,6 +539,7 @@ struct AdditionalKeywords {
|
|||
kw_var = &IdentTable.get("var");
|
||||
|
||||
kw_abstract = &IdentTable.get("abstract");
|
||||
kw_assert = &IdentTable.get("assert");
|
||||
kw_extends = &IdentTable.get("extends");
|
||||
kw_implements = &IdentTable.get("implements");
|
||||
kw_instanceof = &IdentTable.get("instanceof");
|
||||
|
@ -580,6 +581,7 @@ struct AdditionalKeywords {
|
|||
|
||||
// Java keywords.
|
||||
IdentifierInfo *kw_abstract;
|
||||
IdentifierInfo *kw_assert;
|
||||
IdentifierInfo *kw_extends;
|
||||
IdentifierInfo *kw_implements;
|
||||
IdentifierInfo *kw_instanceof;
|
||||
|
|
|
@ -860,7 +860,7 @@ private:
|
|||
Contexts.back().IsExpression = true;
|
||||
} else if (Current.is(TT_TrailingReturnArrow)) {
|
||||
Contexts.back().IsExpression = false;
|
||||
} else if (Current.is(TT_LambdaArrow)) {
|
||||
} else if (Current.is(TT_LambdaArrow) || Current.is(Keywords.kw_assert)) {
|
||||
Contexts.back().IsExpression = Style.Language == FormatStyle::LK_Java;
|
||||
} else if (Current.is(tok::l_paren) && !Line.MustBeDeclaration &&
|
||||
!Line.InPPDirective &&
|
||||
|
|
|
@ -393,6 +393,11 @@ TEST_F(FormatTestJava, SynchronizedKeyword) {
|
|||
"}");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJava, AssertKeyword) {
|
||||
verifyFormat("assert a && b;");
|
||||
}
|
||||
|
||||
|
||||
TEST_F(FormatTestJava, PackageDeclarations) {
|
||||
verifyFormat("package some.really.loooooooooooooooooooooong.package;",
|
||||
getStyleWithColumns(50));
|
||||
|
|
Loading…
Reference in New Issue