clang-format: [Java] Support extending inner classes.

Before:
  class A extends B
  .C {}

After:
  class A extends B.C {}

llvm-svn: 220280
This commit is contained in:
Daniel Jasper 2014-10-21 09:31:29 +00:00
parent f1f0c35632
commit 4bf9d470cb
2 changed files with 5 additions and 3 deletions

View File

@ -1375,9 +1375,10 @@ void UnwrappedLineParser::parseRecord() {
} }
// The actual identifier can be a nested name specifier, and in macros // The actual identifier can be a nested name specifier, and in macros
// it is often token-pasted. // it is often token-pasted.
while (FormatTok->Tok.is(tok::identifier) || while (
FormatTok->Tok.is(tok::coloncolon) || FormatTok->is(tok::identifier) || FormatTok->is(tok::coloncolon) ||
FormatTok->Tok.is(tok::hashhash)) FormatTok->is(tok::hashhash) ||
(Style.Language == FormatStyle::LK_Java && FormatTok->is(tok::period)))
nextToken(); nextToken();
// Note that parsing away template declarations here leads to incorrectly // Note that parsing away template declarations here leads to incorrectly

View File

@ -57,6 +57,7 @@ TEST_F(FormatTestJava, ClassDeclarations) {
" int j;\n" " int j;\n"
" }\n" " }\n"
"}"); "}");
verifyFormat("public class A extends B.C {}");
} }
TEST_F(FormatTestJava, ThrowsDeclarations) { TEST_F(FormatTestJava, ThrowsDeclarations) {