Files
swift-mirror/test/refactoring/ConvertAsync/Inputs/convert_bool_objc.h
Hamish Knight 7df0786c38 [Refactoring] Support Obj-C style bool flag checks
Add an additional case to `CallbackCondition` to
support boolean checks, and add the necessary
classification logic to determine whether a bool
flag check is for a success or failure path.

The logic currently first checks to see if the
async alternative has a convention that specifies
which parameter the flag is, and whether it's a
success or failure flag. If so, it classifies the
flag check accordingly. If there's no async
convention specified, we use a heuristic to see if
the error parameter is force unwrapped in the
failure block. If so, we treat that as the error
path. If there's no force unwrap of the error, we
leave the condition unhandled.

rdar://74063899
2021-05-28 13:10:26 +01:00

14 lines
600 B
Objective-C

@import Foundation;
@interface ClassWithHandlerMethods
+ (void)firstBoolFlagSuccess:(NSString *_Nonnull)str
completion:(void (^_Nonnull)(NSString *_Nullable, BOOL, BOOL,
NSError *_Nullable))handler
__attribute__((swift_async_error(zero_argument, 2)));
+ (void)secondBoolFlagFailure:(NSString *_Nonnull)str
completion:(void (^_Nonnull)(NSString *_Nullable, BOOL, BOOL,
NSError *_Nullable))handler
__attribute__((swift_async_error(nonzero_argument, 3)));
@end