Revision: 3063 http://trac.macosforge.org/projects/ruby/changeset/3063 Author: lsansonetti@apple.com Date: 2009-11-29 23:35:11 -0800 (Sun, 29 Nov 2009) Log Message: ----------- when registering a method as a BS informal protocol, pad the signature with @ in case the ruby arity is greater than the objc one Modified Paths: -------------- MacRuby/trunk/objc.h MacRuby/trunk/vm.cpp Modified: MacRuby/trunk/objc.h =================================================================== --- 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 =================================================================== --- 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
participants (1)
-
source_changes@macosforge.org