[前][次][番号順一覧][スレッド一覧]

ruby-changes:32379

From: nobu <ko1@a...>
Date: Sun, 29 Dec 2013 12:11:24 +0900 (JST)
Subject: [ruby-changes:32379] nobu:r44458 (trunk): proc.c: fix inherited method owner

nobu	2013-12-29 12:11:17 +0900 (Sun, 29 Dec 2013)

  New Revision: 44458

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44458

  Log:
    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.

  Modified files:
    trunk/ChangeLog
    trunk/proc.c
    trunk/vm_insnhelper.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44457)
+++ ChangeLog	(revision 44458)
@@ -1,15 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Dec 29 12:11:11 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@g...>
 
 	* 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@r...>
-
-	* 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@g...>
 
 	* compar.c (cmp_eq_recursive): Fix the return value, the value for
Index: proc.c
===================================================================
--- proc.c	(revision 44457)
+++ proc.c	(revision 44458)
@@ -1224,10 +1224,6 @@ mnew_from_me(rb_method_entry_t *me, VALU https://github.com/ruby/ruby/blob/trunk/proc.c#L1224
 	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 https://github.com/ruby/ruby/blob/trunk/proc.c#L1445
 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
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 44457)
+++ vm_insnhelper.c	(revision 44458)
@@ -2024,11 +2024,6 @@ vm_search_super_method(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2024
 		 " 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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]