[macruby-changes] [4409] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 5 17:40:08 PDT 2010
Revision: 4409
http://trac.macosforge.org/projects/ruby/changeset/4409
Author: lsansonetti at apple.com
Date: 2010-08-05 17:40:08 -0700 (Thu, 05 Aug 2010)
Log Message:
-----------
honor bridgesupport metadata when calculating the default objc signature of a new method
Modified Paths:
--------------
MacRuby/trunk/objc.h
MacRuby/trunk/objc.m
MacRuby/trunk/vm.cpp
Modified: MacRuby/trunk/objc.h
===================================================================
--- MacRuby/trunk/objc.h 2010-08-05 20:30:53 UTC (rev 4408)
+++ MacRuby/trunk/objc.h 2010-08-06 00:40:08 UTC (rev 4409)
@@ -15,6 +15,26 @@
#include "bs.h"
+static inline const char *
+rb_get_bs_method_type(bs_element_method_t *bs_method, int arg)
+{
+ if (bs_method != NULL) {
+ if (arg == -1) {
+ if (bs_method->retval != NULL) {
+ return bs_method->retval->type;
+ }
+ }
+ else {
+ for (unsigned int i = 0; i < bs_method->args_count; i++) {
+ if (bs_method->args[i].index == arg) {
+ return bs_method->args[i].type;
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
bool rb_objc_get_types(VALUE recv, Class klass, SEL sel, Method m,
bs_element_method_t *bs_method, char *buf, size_t buflen);
Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m 2010-08-05 20:30:53 UTC (rev 4408)
+++ MacRuby/trunk/objc.m 2010-08-06 00:40:08 UTC (rev 4409)
@@ -26,27 +26,6 @@
# include "bs.h"
#endif
-static inline const char *
-rb_get_bs_method_type(bs_element_method_t *bs_method, int arg)
-{
- if (bs_method != NULL) {
- if (arg == -1) {
- if (bs_method->retval != NULL) {
- return bs_method->retval->type;
- }
- }
- else {
- int i;
- for (i = 0; i < bs_method->args_count; i++) {
- if (bs_method->args[i].index == arg) {
- return bs_method->args[i].type;
- }
- }
- }
- }
- return NULL;
-}
-
bool
rb_objc_get_types(VALUE recv, Class klass, SEL sel, Method method,
bs_element_method_t *bs_method, char *buf, size_t buflen)
Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp 2010-08-05 20:30:53 UTC (rev 4408)
+++ MacRuby/trunk/vm.cpp 2010-08-06 00:40:08 UTC (rev 4409)
@@ -1664,6 +1664,16 @@
#endif
}
+static const char *
+get_bs_method_type(bs_element_method_t *bs_method, int idx)
+{
+ const char *type = rb_get_bs_method_type(bs_method, idx);
+ if (type == NULL) {
+ type = "@";
+ }
+ return type;
+}
+
static void
resolve_method_type(char *buf, const size_t buflen, Class klass, Method m,
SEL sel, const unsigned int types_count)
@@ -1716,6 +1726,19 @@
else if (kvo_sel(klass, selname, selsize, "get", ":range:")) {
}
#endif
+ else if (bs_method != NULL) {
+ buf[0] = '\0';
+
+ // retval, self and sel.
+ strlcat(buf, get_bs_method_type(bs_method, -1), buflen);
+ strlcat(buf, "@", buflen);
+ strlcat(buf, ":", buflen);
+
+ // Arguments.
+ for (unsigned int i = 3; i < types_count; i++) {
+ strlcat(buf, get_bs_method_type(bs_method, i - 3), buflen);
+ }
+ }
else {
assert(types_count < buflen);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100805/39d858b1/attachment.html>
More information about the macruby-changes
mailing list