instance_methods etc should not include undef'ed method names; based on a...

instance_methods etc should not include undef'ed method names; based on a patch from @cremno; fix #2613
parent cee3dc58
......@@ -614,7 +614,7 @@ method_entry_loop(mrb_state *mrb, struct RClass* klass, khash_t(st)* set)
khash_t(mt) *h = klass->mt;
if (!h) return;
for (i=0;i<kh_end(h);i++) {
if (kh_exist(h, i)) {
if (kh_exist(h, i) && kh_value(h, i)) {
kh_put(st, mrb, set, kh_key(h, i));
}
}
......
......@@ -469,6 +469,7 @@ assert('Module#undef_method', '15.2.2.4.42') do
assert_true Test4UndefMethod::Parent.new.respond_to?(:hello)
assert_false Test4UndefMethod::Child.new.respond_to?(:hello)
assert_false Test4UndefMethod::GrandChild.new.respond_to?(:hello)
assert_false Test4UndefMethod::Child.instance_methods(false).include? :hello
end
# Not ISO specified
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment