clang-format: [Java] Support anonymous classes after = and return.
Before:
A a = new A(){public String toString(){return "NotReallyA";
}
}
;
After:
A a = return new A() {
public String toString() {
return "NotReallyA";
}
};
This fixes llvm.org/PR22878.
llvm-svn: 232042
This commit is contained in:
@@ -153,6 +153,19 @@ TEST_F(FormatTestJava, ClassDeclarations) {
|
||||
"}");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJava, AnonymousClasses) {
|
||||
verifyFormat("return new A() {\n"
|
||||
" public String toString() {\n"
|
||||
" return \"NotReallyA\";\n"
|
||||
" }\n"
|
||||
"};");
|
||||
verifyFormat("A a = new A() {\n"
|
||||
" public String toString() {\n"
|
||||
" return \"NotReallyA\";\n"
|
||||
" }\n"
|
||||
"};");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJava, EnumDeclarations) {
|
||||
verifyFormat("enum SomeThing { ABC, CDE }");
|
||||
verifyFormat("enum SomeThing {\n"
|
||||
|
||||
Reference in New Issue
Block a user