Permalink
Browse files

honor bridgesupport signature when callbacking a ruby method from objc

  • Loading branch information...
1 parent 3195e32 commit c19ebfec2c7ea9bafe0d627f19005d5945f8aaaa @lrz lrz committed Aug 20, 2008
Showing with 12 additions and 4 deletions.
  1. +12 −4 objc.m
View
16 objc.m
@@ -946,6 +946,8 @@
bs_element_method_t *
rb_bs_find_method(Class klass, SEL sel)
{
+ if (bs_classes == NULL)
+ return NULL;
do {
bs_element_indexed_class_t *bs_class;
bs_element_method_t *bs_method;
@@ -1241,10 +1243,12 @@
ID mid;
VALUE rrcv, ret;
Method method;
- char type[128];
+ const char *type;
+ char buf[128];
long i, argc;
VALUE *argv, klass;
NODE *body, *node;
+ bs_element_method_t *bs_method;
rcv = (*(id **)args)[0];
sel = (*(SEL **)args)[1];
@@ -1253,13 +1257,16 @@
method = class_getInstanceMethod(*(Class *)rcv, sel);
assert(method != NULL);
+ bs_method = rb_bs_find_method(*(Class *)rcv, sel);
argc = cif->nargs - 2;
argv = (VALUE *)alloca(sizeof(VALUE) * argc);
for (i = 0; i < argc; i++) {
VALUE val;
-
- method_getArgumentType(method, i + 2, type, sizeof type);
+
+ type = rb_objc_method_get_type(method, cif->nargs, bs_method,
+ i, buf, sizeof buf);
+
rb_objc_ocval_to_rbval(args[i + 2], type, &val);
argv[i] = val;
}
@@ -1278,7 +1285,8 @@ VALUE rb_vm_call(rb_thread_t * th, VALUE klass, VALUE recv, VALUE id,
ret = rb_vm_call(GET_THREAD(), klass, rrcv, mid, Qnil,
argc, argv, node, 0);
- method_getReturnType(method, type, sizeof type);
+ type = rb_objc_method_get_type(method, cif->nargs, bs_method,
+ -1, buf, sizeof buf);
rb_objc_rval_to_ocval(ret, type, resp);
}

0 comments on commit c19ebfe

Please sign in to comment.