Remove unused -[RCTBridgeMethod profileArgs]

Reviewed By: mhorowitz

Differential Revision: D3801106

fbshipit-source-id: 214a18b548f8142c0f3d6b2f7db7a24894d1f01d
This commit is contained in:
Pieter De Baets 2016-09-05 07:32:19 -07:00 committed by Facebook Github Bot 2
parent 3c1b69c1a9
commit 753b37e479
2 changed files with 27 additions and 37 deletions

View File

@ -19,7 +19,6 @@ typedef NS_ENUM(NSUInteger, RCTFunctionType) {
@protocol RCTBridgeMethod <NSObject>
@property (nonatomic, copy, readonly) NSString *JSMethodName;
@property (nonatomic, copy, readonly) NSDictionary *profileArgs;
@property (nonatomic, readonly) RCTFunctionType functionType;
- (void)invokeWithBridge:(RCTBridge *)bridge

View File

@ -27,7 +27,7 @@ typedef BOOL (^RCTArgumentBlock)(RCTBridge *, NSUInteger, id);
nullability:(RCTNullability)nullability
unused:(BOOL)unused
{
if ((self = [super init])) {
if (self = [super init]) {
_type = [type copy];
_nullability = nullability;
_unused = unused;
@ -44,11 +44,9 @@ typedef BOOL (^RCTArgumentBlock)(RCTBridge *, NSUInteger, id);
NSArray<RCTArgumentBlock> *_argumentBlocks;
NSString *_methodSignature;
SEL _selector;
NSDictionary *_profileArgs;
}
@synthesize JSMethodName = _JSMethodName;
@synthesize functionType = _functionType;
static void RCTLogArgumentError(RCTModuleMethod *method, NSUInteger index,
id valueOrType, const char *issue)
@ -157,27 +155,10 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
JSMethodName:(NSString *)JSMethodName
moduleClass:(Class)moduleClass
{
if ((self = [super init])) {
if (self = [super init]) {
_moduleClass = moduleClass;
_methodSignature = [methodSignature copy];
_JSMethodName = JSMethodName.length > 0 ? JSMethodName : ({
NSString *methodName = methodSignature;
NSRange colonRange = [methodName rangeOfString:@":"];
if (colonRange.location != NSNotFound) {
methodName = [methodName substringToIndex:colonRange.location];
}
methodName = [methodName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
RCTAssert(methodName.length, @"%@ is not a valid JS function name, please"
" supply an alternative using RCT_REMAP_METHOD()", methodSignature);
methodName;
});
if ([_methodSignature rangeOfString:@"RCTPromise"].length) {
_functionType = RCTFunctionTypePromise;
} else {
_functionType = RCTFunctionTypeNormal;
}
_JSMethodName = [JSMethodName copy];
}
return self;
@ -218,7 +199,6 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
__weak RCTModuleMethod *weakSelf = self;
void (^addBlockArgument)(void) = ^{
RCT_ARG_BLOCK(
if (RCT_DEBUG && json && ![json isKindOfClass:[NSNumber class]]) {
RCTLogArgumentError(weakSelf, index, json, "should be a function");
return NO;
@ -424,17 +404,29 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
return _selector;
}
- (NSDictionary *)profileArgs
- (NSString *)JSMethodName
{
if (!_profileArgs) {
// This sets _selector
[self processMethodSignature];
_profileArgs = @{
@"module": NSStringFromClass(_moduleClass),
@"selector": NSStringFromSelector(_selector),
};
NSString *methodName = _JSMethodName;
if (methodName.length == 0) {
methodName = _methodSignature;
NSRange colonRange = [methodName rangeOfString:@":"];
if (colonRange.location != NSNotFound) {
methodName = [methodName substringToIndex:colonRange.location];
}
methodName = [methodName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
RCTAssert(methodName.length, @"%@ is not a valid JS function name, please"
" supply an alternative using RCT_REMAP_METHOD()", _methodSignature);
}
return methodName;
}
- (RCTFunctionType)functionType
{
if ([_methodSignature rangeOfString:@"RCTPromise"].length) {
return RCTFunctionTypePromise;
} else {
return RCTFunctionTypeNormal;
}
return _profileArgs;
}
- (void)invokeWithBridge:(RCTBridge *)bridge
@ -446,7 +438,6 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
}
if (RCT_DEBUG) {
// Sanity check
RCTAssert([module class] == _moduleClass, @"Attempted to invoke method \
%@ on a module of class %@", [self methodName], [module class]);
@ -457,7 +448,7 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
NSInteger expectedCount = _argumentBlocks.count;
// Subtract the implicit Promise resolver and rejecter functions for implementations of async functions
if (_functionType == RCTFunctionTypePromise) {
if (self.functionType == RCTFunctionTypePromise) {
actualCount -= 2;
expectedCount -= 2;
}
@ -519,8 +510,8 @@ SEL RCTParseMethodSignature(NSString *methodSignature, NSArray<RCTMethodArgument
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p; exports %@ as %@();>",
[self class], self, [self methodName], _JSMethodName];
return [NSString stringWithFormat:@"<%@: %p; exports %@ as %@()>",
[self class], self, [self methodName], self.JSMethodName];
}
@end