}
if (CurrentToken->isOneOf(tok::r_square, tok::r_brace))
return false;
+ else if (CurrentToken->is(tok::l_brace))
+ Left->Type = TT_Unknown; // Not TT_ObjCBlockLParen
updateParameterCount(Left, CurrentToken);
if (CurrentToken->is(tok::comma) && CurrentToken->Next &&
!CurrentToken->Next->HasUnescapedNewline &&
verifyGoogleFormat("- foo:(int)foo;");
}
-TEST_F(FormatTest, FormatObjCBlocks) {
- verifyFormat("int (^Block)(int, int);");
- verifyFormat("int (^Block1)(int, int) = ^(int i, int j)");
-}
-
TEST_F(FormatTest, FormatObjCInterface) {
verifyFormat("@interface Foo : NSObject <NSSomeDelegate> {\n"
"@public\n"
}
TEST_F(FormatTest, FormatsBlocks) {
+ verifyFormat("int (^Block)(int, int);");
+ verifyFormat("int (^Block1)(int, int) = ^(int i, int j)");
+
+ verifyFormat("foo(^{ bar(); });");
+ verifyFormat("foo(a, ^{ bar(); });");
+
// FIXME: Make whitespace formatting consistent. Ask a ObjC dev how
// it would ideally look.
verifyFormat("[operation setCompletionBlock:^{ [self onOperationDone]; }];");