mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Kernel#respond_to? should return false if the method is undefined.
This commit is contained in:
+8
-2
@@ -1052,8 +1052,14 @@ mrb_obj_respond_to(struct RClass* c, mrb_sym mid)
|
||||
|
||||
if (h) {
|
||||
k = kh_get(mt, h, mid);
|
||||
if (k != kh_end(h))
|
||||
return 1; /* exist method */
|
||||
if (k != kh_end(h)) {
|
||||
if (kh_value(h, k)) {
|
||||
return 1; /* exist method */
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
c = c->super;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user