Before:
void f()
{
[object
someMethod:@
{ @"a" : @"b" }];
}
After:
void f()
{
[object someMethod:@{ @"a" : @"b" }];
}
This fixes llvm.org/PR19854.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209615
91177308-0d34-0410-b5e6-
96231b3b80d8
!Style.ConstructorInitializerAllOnOneLineOrOnePerLine) {
return true;
} else if (Right.is(tok::l_brace) && Right.BlockKind == BK_Block &&
- Right.Type != TT_ObjCBlockLBrace) {
+ Right.Type != TT_ObjCBlockLBrace && Right.Type != TT_DictLiteral) {
return Style.BreakBeforeBraces == FormatStyle::BS_Allman ||
Style.BreakBeforeBraces == FormatStyle::BS_GNU;
} else if (Right.is(tok::string_literal) &&
"#endif",
BreakBeforeBrace);
- // This shouldn't affect ObjC blocks.
+ // This shouldn't affect ObjC blocks..
verifyFormat("[self doSomeThingWithACompletionHandler:^{\n"
" // ...\n"
" int i;\n"
- "}];");
+ "}];",
+ BreakBeforeBrace);
verifyFormat("void (^block)(void) = ^{\n"
" // ...\n"
" int i;\n"
- "};");
+ "};",
+ BreakBeforeBrace);
+ // .. or dict literals.
+ verifyFormat("void f()\n"
+ "{\n"
+ " [object someMethod:@{ @\"a\" : @\"b\" }];\n"
+ "}",
+ BreakBeforeBrace);
BreakBeforeBrace.ColumnLimit = 19;
verifyFormat("void f() { int i; }", BreakBeforeBrace);