Skip to content

Commit

Permalink
Merge pull request #3958 from vishalduggal/timob-13011-hotfix
Browse files Browse the repository at this point in the history
[TIMOB-13011] Ensure we update methodsignature
  • Loading branch information
srahim committed Mar 12, 2013
2 parents 5d88c05 + 4b646d4 commit 899f43b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions iphone/Classes/KrollMethod.m
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ -(void)dealloc
[super dealloc];
}

-(void)setSelector:(SEL)selector_
{
selector = selector_;
_methodSignature = [target methodSignatureForSelector:selector];
}

-(void)updateJSObjectWithValue:(id)value forKey:(NSString *)key
{
if (!updatesProperty)
Expand Down Expand Up @@ -251,7 +257,7 @@ -(id)call:(NSArray*)args
{
//TODO: This likely could be further optimized later
//
bool useResult = [self.methodSignature methodReturnLength] == sizeof(id);
bool useResult = [_methodSignature methodReturnLength] == sizeof(id);
id result = nil;
id delegate = context.delegate;
IMP methodFunction = [target methodForSelector:selector];
Expand All @@ -267,7 +273,7 @@ -(id)call:(NSArray*)args


// create proxy method invocation
if (self.methodSignature==nil)
if (_methodSignature==nil)
{
@throw [NSException exceptionWithName:@"org.appcelerator.kroll" reason:[NSString stringWithFormat:@"invalid method '%@'",NSStringFromSelector(selector)] userInfo:nil];
}
Expand All @@ -280,7 +286,7 @@ -(id)call:(NSArray*)args
[target setExecutionContext:context.delegate];
}

int methodArgCount = [self.methodSignature numberOfArguments];
int methodArgCount = [_methodSignature numberOfArguments];

if (methodArgCount > 0 && argcount > 0)
{
Expand Down Expand Up @@ -312,14 +318,14 @@ -(id)call:(NSArray*)args
}
}

if ([self.methodSignature methodReturnLength] == sizeof(id))
if ([_methodSignature methodReturnLength] == sizeof(id))
{
id result;
result = methodFunction(target,selector,arg1,arg2);
return result;
}

const char * retType = [self.methodSignature methodReturnType];
const char * retType = [_methodSignature methodReturnType];
char t = retType[0];
switch(t)
{
Expand Down

0 comments on commit 899f43b

Please sign in to comment.