Revision: 549 http://trac.macosforge.org/projects/ruby/changeset/549 Author: lsansonetti@apple.com Date: 2008-09-03 15:34:53 -0700 (Wed, 03 Sep 2008) Log Message: ----------- foo(*args) is always compiled as foo:, even if args is [] Modified Paths: -------------- MacRuby/trunk/gc.c MacRuby/trunk/vm_insnhelper.c Modified: MacRuby/trunk/gc.c =================================================================== --- MacRuby/trunk/gc.c 2008-09-03 22:20:17 UTC (rev 548) +++ MacRuby/trunk/gc.c 2008-09-03 22:34:53 UTC (rev 549) @@ -453,6 +453,7 @@ if (__nsobject == NULL) __nsobject = (void *)objc_getClass("NSObject"); RBASIC(obj)->klass = (VALUE)__nsobject; + //DLOG("NEWOBJ", "size %ld -> %p", size, obj); return obj; } @@ -1367,4 +1368,4 @@ rb_define_method(rb_mKernel, "object_id", rb_obj_id, 0); rb_define_module_function(rb_mObSpace, "count_objects", count_objects, -1); -} \ No newline at end of file +} Modified: MacRuby/trunk/vm_insnhelper.c =================================================================== --- MacRuby/trunk/vm_insnhelper.c 2008-09-03 22:20:17 UTC (rev 548) +++ MacRuby/trunk/vm_insnhelper.c 2008-09-03 22:34:53 UTC (rev 549) @@ -831,8 +831,23 @@ else { const char *p = (const char *)mcache->as.rcall.sel; size_t len = strlen(p); + char buf[100]; + if (p[len - 1] == ':' && num == 0) { + SEL new_sel; + + /* foo(*args) is always compiled as foo:, even if args is [] */ + strncpy(buf, p, sizeof buf); + buf[MIN(sizeof buf, len) - 1] = '\0'; + new_sel = sel_registerName(buf); + + mn = rb_objc_method_node2(klass, new_sel, NULL); + if (mn != NULL) { + mcache->as.rcall.sel = new_sel; + mcache->as.rcall.node = mn; + goto rcall_dispatch; + } + } if (len >= 3) { - char buf[100]; SEL sel = 0; if (isalpha(p[len - 3]) && p[len - 2] == '=' && p[len - 1] == ':') { /* foo=: -> setFoo: shortcut */