Clean up after recent RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD changes

Reviewed By: javache

Differential Revision: D4969636

fbshipit-source-id: 49785dcf02e6544a313d82ccb26839ac2302c7d9
This commit is contained in:
Alex Dvornikov 2017-04-28 05:32:13 -07:00 committed by Facebook Github Bot
parent ce9cdddeda
commit d1fb892715
2 changed files with 8 additions and 11 deletions

View File

@ -172,7 +172,7 @@ RCT_EXTERN void RCTRegisterModule(Class); \
* { ... }
*/
#define RCT_REMAP_METHOD(js_name, method) \
RCT_EXTERN_REMAP_METHOD(js_name, method, NO) \
_RCT_EXTERN_REMAP_METHOD(js_name, method, NO) \
- (void)method;
/**
@ -184,7 +184,7 @@ RCT_EXTERN void RCTRegisterModule(Class); \
* { ... }
*/
#define RCT_REMAP_BLOCKING_SYNCHRONOUS_METHOD(js_name, method) \
RCT_EXTERN_REMAP_METHOD(js_name, method, YES) \
_RCT_EXTERN_REMAP_METHOD(js_name, method, YES) \
- (id)method;
/**
@ -234,20 +234,20 @@ RCT_EXTERN void RCTRegisterModule(Class); \
* of an external module.
*/
#define RCT_EXTERN_METHOD(method) \
RCT_EXTERN_REMAP_METHOD(, method, NO)
_RCT_EXTERN_REMAP_METHOD(, method, NO)
/**
* Use this macro in accordance with RCT_EXTERN_MODULE to export methods
* of an external module that should be invoked synchronously.
*/
#define RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(method) \
RCT_EXTERN_REMAP_METHOD(, method, YES)
_RCT_EXTERN_REMAP_METHOD(, method, YES)
/**
* Like RCT_EXTERN_REMAP_METHOD, but allows setting a custom JavaScript name
* and also whether this method is synchronous.
*/
#define RCT_EXTERN_REMAP_METHOD(js_name, method, is_blocking_synchronous_method) \
#define _RCT_EXTERN_REMAP_METHOD(js_name, method, is_blocking_synchronous_method) \
+ (NSArray *)RCT_CONCAT(__rct_export__, \
RCT_CONCAT(js_name, RCT_CONCAT(__LINE__, __COUNTER__))) { \
return @[@#js_name, @#method, @is_blocking_synchronous_method]; \

View File

@ -460,7 +460,7 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
- (RCTFunctionType)functionType
{
if ([_methodSignature rangeOfString:@"RCTPromise"].length) {
RCTAssert(_isSync == NO, @"Promises cannot be used in sync functions");
RCTAssert(!_isSync, @"Promises cannot be used in sync functions");
return RCTFunctionTypePromise;
} else if (_isSync) {
@ -540,7 +540,6 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
}
id result = nil;
if (_isSync) {
void *pointer;
[_invocation getReturnValue:&pointer];
@ -561,10 +560,8 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
- (NSString *)description
{
NSString *descriptor = [NSString stringWithCString:RCTFunctionDescriptorFromType(self.functionType)
encoding:NSString.defaultCStringEncoding];
return [NSString stringWithFormat:@"<%@: %p; exports %@ as %@(); type: %@>",
[self class], self, [self methodName], self.JSMethodName, descriptor];
return [NSString stringWithFormat:@"<%@: %p; exports %@ as %@(); type: %s>",
[self class], self, [self methodName], self.JSMethodName, RCTFunctionDescriptorFromType(self.functionType)];
}
@end