clang-format/java: Always put space after `assert` keyword.

Previously, it was missing if the expression after the assert started with a (.

llvm-svn: 314172
This commit is contained in:
Nico Weber 2017-09-25 22:42:49 +00:00
parent 2eccdab308
commit e8eba3716c
2 changed files with 3 additions and 0 deletions

View File

@ -2185,6 +2185,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
const FormatToken &Right) {
if (Left.is(tok::kw_return) && Right.isNot(tok::semi))
return true;
if (Left.is(Keywords.kw_assert) && Style.Language == FormatStyle::LK_Java)
return true;
if (Style.ObjCSpaceAfterProperty && Line.Type == LT_ObjCProperty &&
Left.Tok.getObjCKeywordID() == tok::objc_property)
return true;

View File

@ -412,6 +412,7 @@ TEST_F(FormatTestJava, SynchronizedKeyword) {
TEST_F(FormatTestJava, AssertKeyword) {
verifyFormat("assert a && b;");
verifyFormat("assert (a && b);");
}
TEST_F(FormatTestJava, PackageDeclarations) {