Permalink
Browse files

fixed Module#method_defined?

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@2375 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
lrz committed Aug 25, 2009
1 parent 1422146 commit 914ab2b8981c85a4e97c4bb74f6b308e41113d33
Showing with 9 additions and 8 deletions.
  1. +2 −2 include/ruby/intern.h
  2. +7 −6 vm_method.c
View
@@ -262,8 +262,8 @@ void rb_alias(VALUE, ID, ID);
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);
View
@@ -377,7 +377,8 @@ rb_mod_undef_method(VALUE mod, SEL sel, int argc, VALUE *argv)
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,21 +765,21 @@ rb_mod_modfunc(VALUE module, SEL sel, int argc, VALUE *argv)
//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);
if (!rb_vm_respond_to(obj, sel, priv)) {
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);

0 comments on commit 914ab2b

Please sign in to comment.