aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-10 14:18:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-10 14:18:52 +0000
commitdfba8d429611cb8863351a2ec8d8dc049a08c2df (patch)
tree8b8a9748353115477a1ba6e6e34602f460ea6369 /vm_eval.c
parentbff3f1818977389601c8caf5677b32e52e367974 (diff)
downloadruby-dfba8d429611cb8863351a2ec8d8dc049a08c2df.tar.gz
vm_eval.c: fix refined method when prepended
* vm_eval.c (vm_call0_body): refined module should not be skipped as prepended. [ruby-core:78073] [Bug #12920] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/vm_eval.c b/vm_eval.c
index ace21b0468..807d560741 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -194,14 +194,19 @@ vm_call0_body(rb_thread_t* th, struct rb_calling_info *calling, const struct rb_
case VM_METHOD_TYPE_REFINED:
{
const rb_method_type_t type = cc->me->def->type;
- VALUE super_class;
+ VALUE super_class = cc->me->defined_class;
- if (type == VM_METHOD_TYPE_REFINED && cc->me->def->body.refined.orig_me) {
- cc->me = refined_method_callable_without_refinement(cc->me);
- goto again;
+ if (type == VM_METHOD_TYPE_REFINED) {
+ if (cc->me->def->body.refined.orig_me) {
+ cc->me = refined_method_callable_without_refinement(cc->me);
+ goto again;
+ }
+ }
+ else {
+ super_class = RCLASS_ORIGIN(super_class);
}
- super_class = RCLASS_SUPER(RCLASS_ORIGIN(cc->me->defined_class));
+ super_class = RCLASS_SUPER(super_class);
if (!super_class || !(cc->me = rb_callable_method_entry(super_class, ci->mid))) {
enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0;