Modified: MacRuby/trunk/objc.h (3062 => 3063)
--- MacRuby/trunk/objc.h 2009-11-30 06:35:37 UTC (rev 3062)
+++ MacRuby/trunk/objc.h 2009-11-30 07:35:11 UTC (rev 3063)
@@ -168,6 +168,17 @@
}
}
+static inline unsigned int
+TypeArity(const char *type)
+{
+ unsigned int arity = 0;
+ while (*type != '\0') {
+ type = SkipFirstType(type);
+ arity++;
+ }
+ return arity;
+}
+
#if defined(__cplusplus)
}
#endif
Modified: MacRuby/trunk/vm.cpp (3062 => 3063)
--- MacRuby/trunk/vm.cpp 2009-11-30 06:35:37 UTC (rev 3062)
+++ MacRuby/trunk/vm.cpp 2009-11-30 07:35:11 UTC (rev 3063)
@@ -1610,7 +1610,16 @@
GET_CORE()->find_bs_informal_protocol_method(sel,
class_isMetaClass(klass));
if (informal_type != NULL) {
- strncpy(buf, informal_type->c_str(), buflen);
+ // Get the signature from the BridgeSupport database as an
+ // informal protocol method.
+ const char *informal_type_str = informal_type->c_str();
+ strncpy(buf, informal_type_str, buflen);
+ const unsigned int type_arity = TypeArity(informal_type_str);
+ if (oc_arity > type_arity) {
+ for (unsigned int i = type_arity; i < oc_arity; i++) {
+ strlcat(buf, "@", buflen);
+ }
+ }
}
else {
// Generate an automatic signature, using 'id' (@) for all