Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-13011] Ensure we update methodsignature #3958

Merged
merged 1 commit into from
Mar 12, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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