diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-07 04:09:51 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-07 04:09:51 +0000 |
commit | 5836962f48200c71f5989315b9e2ac4db2b87541 (patch) | |
tree | 0bfbe67f67e006879dc95fd4c76f7a8b57b24975 /vm_method.c | |
parent | 1c5104ac9c0803c476b54d751b0ec4579a1828af (diff) | |
download | ruby-5836962f48200c71f5989315b9e2ac4db2b87541.tar.gz |
* eval.c (rb_mod_refine): set RMODULE_IS_REFINEMENT to a created
refinement module, and don't override method_added.
* vm_method.c (rb_method_entry_make): check redefinition of
optimized methods when a method is added to a refinement module.
[ruby-core:48970] [Bug #7290]
* test/ruby/test_refinement.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c index 033c81f262..ca521563e5 100644 --- a/vm_method.c +++ b/vm_method.c @@ -167,6 +167,8 @@ rb_free_method_entry(rb_method_entry_t *me) static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2); +void rb_redefine_opt_method(VALUE, ID); + static rb_method_entry_t * rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type, rb_method_definition_t *def, rb_method_flag_t noex) @@ -196,6 +198,14 @@ rb_method_entry_make(VALUE klass, ID mid, rb_method_type_t type, #if NOEX_NOREDEF rklass = klass; #endif + if (FL_TEST(klass, RMODULE_IS_REFINEMENT)) { + ID id_refined_class; + VALUE refined_class; + + CONST_ID(id_refined_class, "__refined_class__"); + refined_class = rb_ivar_get(klass, id_refined_class); + rb_redefine_opt_method(refined_class, mid); + } klass = RCLASS_ORIGIN(klass); mtbl = RCLASS_M_TBL(klass); |