mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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
14 lines
600 B
Objective-C
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
|