diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-26 07:59:54 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-01-26 07:59:54 +0000 |
commit | eb1d5ab5a0309e117ea2cb05915131393adc893d (patch) | |
tree | cdce213710d853dd34449fe288cba2628e941106 /vm_args.c | |
parent | 66be165f30cb6a7d52634ce817013e510094bb1e (diff) |
merge revision(s) 66658: [Backport #15489]
vm_args.c: search symbol proc in super classes
* vm_args.c (refine_sym_proc_call): traverse ancestors to search
inherited methods for symbol proc.
[ruby-dev:50741] [Bug #15489]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@66925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_args.c')
-rw-r--r-- | vm_args.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -853,6 +853,7 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)) rb_execution_context_t *ec; const VALUE symbol = RARRAY_AREF(callback_arg, 0); const VALUE refinements = RARRAY_AREF(callback_arg, 1); + VALUE klass; if (argc-- < 1) { rb_raise(rb_eArgError, "no receiver given"); @@ -860,8 +861,13 @@ refine_sym_proc_call(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)) obj = *argv++; mid = SYM2ID(symbol); - me = rb_callable_method_entry(CLASS_OF(obj), mid); - me = rb_resolve_refined_method_callable(refinements, me); + for (klass = CLASS_OF(obj); klass; klass = RCLASS_SUPER(klass)) { + me = rb_callable_method_entry(klass, mid); + if (me) { + me = rb_resolve_refined_method_callable(refinements, me); + if (me) break; + } + } ec = GET_EC(); if (!NIL_P(blockarg)) { |