aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-08 05:16:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-08 05:16:33 +0000
commitf0fd991413da3fc1abdde2f658aabd8becce2138 (patch)
tree1d486994c917fa7f90c71c525689fd5f02479683 /vm_insnhelper.c
parentd0187bcbc7ed7ecc473ea6f51115b5a317087950 (diff)
downloadruby-f0fd991413da3fc1abdde2f658aabd8becce2138.tar.gz
vm_insnhelper.c: zsuper in refinements
* vm_insnhelper.c (vm_call_zsuper): prevent infinite recursion zsuper in refinements. [ruby-core:77161] [Bug #12729] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 43db728aef..b580412bb9 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2016,18 +2016,20 @@ vm_call_method_missing(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb_c
return vm_call_method(th, reg_cfp, calling, ci, cc);
}
+static const rb_callable_method_entry_t *refined_method_callable_without_refinement(const rb_callable_method_entry_t *me);
static VALUE
vm_call_zsuper(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info *calling, const struct rb_call_info *ci, struct rb_call_cache *cc, VALUE klass)
{
klass = RCLASS_SUPER(klass);
cc->me = klass ? rb_callable_method_entry(klass, ci->mid) : NULL;
- if (cc->me != NULL) {
- return vm_call_method_each_type(th, cfp, calling, ci, cc);
- }
- else {
+ if (!cc->me) {
return vm_call_method_nome(th, cfp, calling, ci, cc);
}
+ if (cc->me->def->type == VM_METHOD_TYPE_REFINED) {
+ cc->me = refined_method_callable_without_refinement(cc->me);
+ }
+ return vm_call_method_each_type(th, cfp, calling, ci, cc);
}
static inline VALUE
@@ -2121,6 +2123,11 @@ refined_method_callable_without_refinement(const rb_callable_method_entry_t *me)
}
VM_ASSERT(callable_method_entry_p(cme));
+
+ if (UNDEFINED_METHOD_ENTRY_P(cme)) {
+ cme = NULL;
+ }
+
return cme;
}
@@ -2218,10 +2225,6 @@ vm_call_method_each_type(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_cal
no_refinement_dispatch:
if (cc->me->def->body.refined.orig_me) {
cc->me = refined_method_callable_without_refinement(cc->me);
-
- if (UNDEFINED_METHOD_ENTRY_P(cc->me)) {
- cc->me = NULL;
- }
return vm_call_method(th, cfp, calling, ci, cc);
}
else {