[macruby-changes] [3815] MacRuby/trunk/dispatcher.cpp

source_changes at macosforge.org source_changes at macosforge.org
Thu Mar 18 19:09:49 PDT 2010


Revision: 3815
          http://trac.macosforge.org/projects/ruby/changeset/3815
Author:   lsansonetti at apple.com
Date:     2010-03-18 19:09:47 -0700 (Thu, 18 Mar 2010)
Log Message:
-----------
when dispatching a custom #respond_to? method, do not pass the second optional argument in case the arity is incompatible

Modified Paths:
--------------
    MacRuby/trunk/dispatcher.cpp

Modified: MacRuby/trunk/dispatcher.cpp
===================================================================
--- MacRuby/trunk/dispatcher.cpp	2010-03-18 23:21:52 UTC (rev 3814)
+++ MacRuby/trunk/dispatcher.cpp	2010-03-19 02:09:47 UTC (rev 3815)
@@ -1956,7 +1956,15 @@
 	int n = 0;
 	args[n++] = ID2SYM(rb_intern(sel_getName(sel)));
 	if (priv) {
-	    args[n++] = Qtrue;
+	    rb_vm_method_node_t *node = method_node_get(imp);
+	    if (node != NULL
+		    && (2 < node->arity.min
+			|| (node->arity.max != -1 && 2 > node->arity.max))) {
+		// Do nothing, custom respond_to? method incompatible arity.
+	    }
+	    else {
+		args[n++] = Qtrue;
+	    }
 	}
 	return rb_vm_call(obj, selRespondTo, n, args, false) == Qtrue;
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100318/917d1eba/attachment-0001.html>


More information about the macruby-changes mailing list