1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

proc.c: fix inherited method owner

* proc.c (mnew_from_me): keep iclass as-is, to make inheritance
  chain consistent.  [ruby-core:59358] [Bug #9315]

* proc.c (method_owner): return the original defined_class from
  prepended iclass, instead.

* vm_insnhelper.c (vm_search_super_method): revert r44455, no
  longer defined_class becomes a module.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-12-29 03:11:17 +00:00
parent cb08e70822
commit a69f01fa52
3 changed files with 16 additions and 17 deletions

View file

@ -1,15 +1,16 @@
Sun Dec 29 12:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* proc.c (mnew_from_me): keep iclass as-is, to make inheritance
chain consistent. [ruby-core:59358] [Bug #9315]
* proc.c (method_owner): return the original defined_class from
prepended iclass, instead.
Sun Dec 29 08:47:24 2013 Lucas Allan Amorim <lucas.allan@gmail.com>
* test/ruby/test_sprintf.rb (test_hash): Added tests for sprintf
with a hash as parameter. [Fixes GH-491]
Sun Dec 29 08:21:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_insnhelper.c (vm_search_super_method): direct superclass of a
module is found when super called in a Method object generated a
method defined in a module, call method_missing in that case.
[ruby-core:59358] [Bug #9315]
Sun Dec 29 07:27:51 2013 Benoit Daloze <eregontp@gmail.com>
* compar.c (cmp_eq_recursive): Fix the return value, the value for

13
proc.c
View file

@ -1224,10 +1224,6 @@ mnew_from_me(rb_method_entry_t *me, VALUE defined_class, VALUE klass,
goto again;
}
if (RB_TYPE_P(defined_class, T_ICLASS)) {
defined_class = RBASIC_CLASS(defined_class);
}
klass = defined_class;
while (rclass != klass &&
@ -1449,9 +1445,16 @@ static VALUE
method_owner(VALUE obj)
{
struct METHOD *data;
VALUE defined_class;
TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
return data->defined_class;
defined_class = data->defined_class;
if (RB_TYPE_P(defined_class, T_ICLASS)) {
defined_class = RBASIC_CLASS(defined_class);
}
return defined_class;
}
void

View file

@ -2024,11 +2024,6 @@ vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf
" by define_method() is not supported."
" Specify all arguments explicitly.");
}
if (!ci->klass) {
ci->aux.missing_reason = NOEX_SUPER;
CI_SET_FASTPATH(ci, vm_call_method_missing, 1);
return;
}
/* TODO: use inline cache */
ci->me = rb_method_entry(ci->klass, ci->mid, &ci->defined_class);