mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fix null m_tbl
* class.c (class_instance_method_list): m_tbl in prepended class/module is NULL. [ruby-core:45915][Bug #6655] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
28cb8f5d20
commit
48c04ad0d8
3 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Jun 27 21:01:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* class.c (class_instance_method_list): m_tbl in prepended
|
||||
class/module is NULL. [ruby-core:45915][Bug #6655]
|
||||
|
||||
Wed Jun 27 16:48:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* class.c (rb_prepend_module): prepend module into another module.
|
||||
|
|
2
class.c
2
class.c
|
@ -925,7 +925,7 @@ class_instance_method_list(int argc, VALUE *argv, VALUE mod, int obj, int (*func
|
|||
|
||||
list = st_init_numtable();
|
||||
for (; mod; mod = RCLASS_SUPER(mod)) {
|
||||
st_foreach(RCLASS_M_TBL(mod), method_entry_i, (st_data_t)list);
|
||||
if (RCLASS_M_TBL(mod)) st_foreach(RCLASS_M_TBL(mod), method_entry_i, (st_data_t)list);
|
||||
if (BUILTIN_TYPE(mod) == T_ICLASS) continue;
|
||||
if (obj && FL_TEST(mod, FL_SINGLETON)) continue;
|
||||
if (!recur) break;
|
||||
|
|
|
@ -1270,4 +1270,9 @@ class TestModule < Test::Unit::TestCase
|
|||
expected = [:M2,[:M3,[:C1,[:M4,[:M1,[:C0,[:M0],:C0],:M1],:M4],:C1],:M3],:M2]
|
||||
assert_equal(expected, obj.m1)
|
||||
end
|
||||
|
||||
def test_prepend_instance_methods
|
||||
bug6655 = '[ruby-core:45915]'
|
||||
assert_equal(Object.instance_methods, Class.new {prepend Module.new}.instance_methods, bug6655)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue