diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-29 08:03:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-29 08:03:23 +0000 |
commit | 74b85189b8fd792b98642859639afc5f74a8bb51 (patch) | |
tree | 275fc36973f0e9cd12e45c74d7f4e34415f036cb /vm_insnhelper.c | |
parent | 4cdb8fd7ec806dd7ea9417690424467b5d8a39ac (diff) |
vm_insnhelper.c: fix zsuper in prepended
* vm_insnhelper.c (vm_call_method): a method entry refers the based
class/module, so should search superclass from the origin i-class
where the entry belongs to, to get rid of infinite loop when zsuper
in a prepended class/module. [ruby-core:54105] [Bug #8238]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 761c830235..f196e5dc2d 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1769,6 +1769,8 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) start_method_dispatch: if (ci->me != 0) { if ((ci->me->flag == 0)) { + VALUE klass; + normal_method_dispatch: switch (ci->me->def->type) { case VM_METHOD_TYPE_ISEQ:{ @@ -1801,10 +1803,10 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) return vm_call_bmethod(th, cfp, ci); } case VM_METHOD_TYPE_ZSUPER:{ - VALUE klass; - + klass = ci->me->klass; + klass = RCLASS_ORIGIN(klass); zsuper_method_dispatch: - klass = RCLASS_SUPER(ci->me->klass); + klass = RCLASS_SUPER(klass); ci_temp = *ci; ci = &ci_temp; @@ -1866,6 +1868,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) goto normal_method_dispatch; } else { + klass = ci->me->klass; goto zsuper_method_dispatch; } } |