[macruby-changes] [2375] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 25 14:08:47 PDT 2009


Revision: 2375
          http://trac.macosforge.org/projects/ruby/changeset/2375
Author:   lsansonetti at apple.com
Date:     2009-08-25 14:08:43 -0700 (Tue, 25 Aug 2009)
Log Message:
-----------
fixed Module#method_defined?

Modified Paths:
--------------
    MacRuby/trunk/include/ruby/intern.h
    MacRuby/trunk/vm_method.c

Modified: MacRuby/trunk/include/ruby/intern.h
===================================================================
--- MacRuby/trunk/include/ruby/intern.h	2009-08-25 20:34:45 UTC (rev 2374)
+++ MacRuby/trunk/include/ruby/intern.h	2009-08-25 21:08:43 UTC (rev 2375)
@@ -262,8 +262,8 @@
 void rb_attr(VALUE,ID,int,int,int);
 int rb_method_boundp(VALUE, ID, int);
 VALUE rb_eval_cmd(VALUE, VALUE, int);
-int rb_obj_respond_to(VALUE, ID, int);
-int rb_respond_to(VALUE, ID);
+bool rb_obj_respond_to(VALUE, ID, bool);
+bool rb_respond_to(VALUE, ID);
 void rb_interrupt(void);
 VALUE rb_apply(VALUE, ID, VALUE);
 void rb_backtrace(void);

Modified: MacRuby/trunk/vm_method.c
===================================================================
--- MacRuby/trunk/vm_method.c	2009-08-25 20:34:45 UTC (rev 2374)
+++ MacRuby/trunk/vm_method.c	2009-08-25 21:08:43 UTC (rev 2375)
@@ -377,7 +377,8 @@
 static VALUE
 rb_mod_method_defined(VALUE mod, SEL sel, VALUE mid)
 {
-    return rb_method_boundp(mod, rb_to_id(mid), 1);
+    ID id = rb_to_id(mid);
+    return rb_obj_respond_to(mod, id, true) ? Qtrue : Qfalse;
 }
 
 #define VISI_CHECK(x,f) (((x)&NOEX_MASK) == (f))
@@ -764,8 +765,8 @@
 
 //static NODE *basic_respond_to = 0;
 
-int
-rb_obj_respond_to(VALUE obj, ID id, int priv)
+bool
+rb_obj_respond_to(VALUE obj, ID id, bool priv)
 {
     const char *id_name = rb_id2name(id);
     SEL sel = sel_registerName(id_name);
@@ -773,12 +774,12 @@
 	char buf[100];
 	snprintf(buf, sizeof buf, "%s:", id_name);
 	sel = sel_registerName(buf);
-	return rb_vm_respond_to(obj, sel, priv) == true ? 1 : 0;
+	return rb_vm_respond_to(obj, sel, priv);
     }
-    return 1;
+    return true;
 }
 
-int
+bool
 rb_respond_to(VALUE obj, ID id)
 {
     return rb_obj_respond_to(obj, id, Qfalse);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090825/b36f26ef/attachment.html>


More information about the macruby-changes mailing list