diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-02 08:06:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-02 08:06:37 +0000 |
commit | edb1fc4eb2f9b0bd69398362ae40100adfd5577e (patch) | |
tree | 48a12ca98a1780f14164a016b6da7c4707b5a2de /vm_method.c | |
parent | bd52bed97be25e8f3344033ac01416349ec8be67 (diff) | |
download | ruby-edb1fc4eb2f9b0bd69398362ae40100adfd5577e.tar.gz |
prepend: fix mixing with include
* class.c (rb_include_module): include modules after the origin.
* class.c (include_modules_at): skip prepended modules.
* class.c (rb_prepend_module): now basic.klass in ICLASS refers the
old original class/module. [ruby-dev:45868][Bug #6662]
* class.c (rb_mod_ancestors): ditto.
* vm_method.c (search_method): search method entry from the origin
iclass.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/vm_method.c b/vm_method.c index 7546a1c31c..af7c99a95f 100644 --- a/vm_method.c +++ b/vm_method.c @@ -387,15 +387,13 @@ static rb_method_entry_t* search_method(VALUE klass, ID id) { st_data_t body; - if (!klass) { - return 0; - } - while (!RCLASS_M_TBL(klass) || !st_lookup(RCLASS_M_TBL(klass), id, &body)) { - klass = RCLASS_SUPER(klass); - if (!klass) { - return 0; + for (body = 0; klass; klass = RCLASS_SUPER(klass)) { + st_table *m_tbl = RCLASS_M_TBL(klass); + if (!m_tbl) { + m_tbl = RCLASS_M_TBL(RCLASS_ORIGIN(RBASIC(klass)->klass)); } + if (st_lookup(m_tbl, id, &body)) break; } return (rb_method_entry_t *)body; |