mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When generating the completion handler that is passed to ObjC methods that are being called as async Swift functions, the parameters taken by the generated completion handler are matched up with the values that are returned from the async function. Previously, this process was done by starting at the index into the list of values expected to be returned, adding 1 if the index matched first the error index and second the flag index, and finally adding 1 to account for the fact that the initial parameter to the completion handler is the block_storage parameter. That strategy was problematic: it failed to increment indices appropriately because it did not skip past the block_storage parameter to begin with; it also failed to increment indices appropriately in certain cases where the flag and error parameters appeared in an unexpected order (flag first, then error). Here, the process is made more robust. Now, the indices which correspond to the block_storage, flag, and error parameters are filtered out to begin with. The remaining indices can then be indexed into using the index into the result tuple (or 0 if the result is not a tuple). rdar://80847020
10 lines
345 B
Objective-C
10 lines
345 B
Objective-C
#import <Foundation/Foundation.h>
|
|
|
|
#pragma clang assume_nonnull begin
|
|
|
|
@interface Clazz : NSObject
|
|
-(void)doSomethingMultiResultFlaggyWithCompletionHandler:(void (^)(BOOL, NSString *_Nullable, NSError *_Nullable, NSString *_Nullable))completionHandler __attribute__((swift_async_error(zero_argument, 1)));
|
|
@end
|
|
|
|
#pragma clang assume_nonnull end
|