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

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 23 03:47:44 PST 2010


Revision: 3590
          http://trac.macosforge.org/projects/ruby/changeset/3590
Author:   martinlagardette at apple.com
Date:     2010-02-23 03:47:44 -0800 (Tue, 23 Feb 2010)
Log Message:
-----------

 - When calling method missing, don't assume #method: takes only one argument
 - Fixes #512

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

Modified: MacRuby/trunk/dispatcher.cpp
===================================================================
--- MacRuby/trunk/dispatcher.cpp	2010-02-23 10:22:36 UTC (rev 3589)
+++ MacRuby/trunk/dispatcher.cpp	2010-02-23 11:47:44 UTC (rev 3590)
@@ -913,7 +913,6 @@
     const char *selname = sel_getName(sel);
     const size_t selname_len = strlen(selname);
     SEL new_sel = 0;
-    int argc_expected;
 
     if (argc > 0 && selname[selname_len - 1] == ':') {
 	char buf[100];
@@ -921,20 +920,20 @@
 	strlcpy(buf, selname, sizeof buf);
 	buf[selname_len - 1] = '\0';
 	new_sel = sel_registerName(buf);
-	argc_expected = 0;
     }
     else if (argc == 0) {
 	char buf[100];
 	snprintf(buf, sizeof buf, "%s:", selname);
 	new_sel = sel_registerName(buf);
-	argc_expected = 1;
     }
     if (new_sel != 0) {
 	Method m = class_getInstanceMethod(klass, new_sel);
-	if (m != NULL
-		&& GET_CORE()->method_node_get(m) != NULL) {
-	    rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
-		    argc, argc_expected);
+	if (m != NULL) {
+	    rb_vm_method_node_t *node = GET_CORE()->method_node_get(m);
+	    if (node != NULL) {
+		rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
+			 argc, node->arity.min);
+	    }
 	}
     }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100223/c0e4c4ff/attachment.html>


More information about the macruby-changes mailing list