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
// it is often token-pasted.
while (FormatTok->Tok.is(tok::identifier) ||
FormatTok->Tok.is(tok::coloncolon) ||
FormatTok->Tok.is(tok::hashhash))
while (
FormatTok->is(tok::identifier) || FormatTok->is(tok::coloncolon) ||
FormatTok->is(tok::hashhash) ||
(Style.Language == FormatStyle::LK_Java && FormatTok->is(tok::period)))
nextToken();
// Note that parsing away template declarations here leads to incorrectly

View File

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