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

ruby-changes:26219

From: shugo <ko1@a...>
Date: Sat, 8 Dec 2012 22:41:26 +0900 (JST)
Subject: [ruby-changes:26219] shugo:r38276 (trunk): * eval.c (rb_mod_refine): don't override Module#include. It's

shugo	2012-12-08 22:41:16 +0900 (Sat, 08 Dec 2012)

  New Revision: 38276

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

  Log:
    * eval.c (rb_mod_refine): don't override Module#include.  It's
      unnecessary now because refinements are activated only in refine
      blocks.

  Modified files:
    trunk/ChangeLog
    trunk/eval.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38275)
+++ ChangeLog	(revision 38276)
@@ -1,3 +1,9 @@
+Sat Dec  8 22:38:35 2012  Shugo Maeda  <shugo@r...>
+
+	* eval.c (rb_mod_refine): don't override Module#include.  It's
+	  unnecessary now because refinements are activated only in refine
+	  blocks.
+
 Sat Dec  8 22:33:26 2012  Shugo Maeda  <shugo@r...>
 
 	* eval.c: remove Module#refinements.
Index: eval.c
===================================================================
--- eval.c	(revision 38275)
+++ eval.c	(revision 38276)
@@ -1118,36 +1118,6 @@
     return rb_attr_get(module, id_refined_class);
 }
 
-static VALUE
-refinement_module_include(int argc, VALUE *argv, VALUE module)
-{
-    rb_thread_t *th = GET_THREAD();
-    rb_control_frame_t *cfp = th->cfp;
-    rb_control_frame_t *end_cfp = RUBY_VM_END_CONTROL_FRAME(th);
-    VALUE result = rb_mod_include(argc, argv, module);
-    NODE *cref;
-    VALUE klass, c;
-
-    klass = rb_refinement_module_get_refined_class(module);
-    while (RUBY_VM_VALID_CONTROL_FRAME_P(cfp, end_cfp)) {
-	if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq) &&
-	    (cref = rb_vm_get_cref(cfp->iseq, cfp->ep)) &&
-	    !NIL_P(cref->nd_refinements) &&
-	    !NIL_P(c = rb_hash_lookup(cref->nd_refinements, klass))) {
-	    while (argc--) {
-		VALUE mod = argv[argc];
-		if (rb_class_inherited_p(module, mod)) {
-		    RCLASS_SUPER(c) =
-			rb_include_class_new(mod, RCLASS_SUPER(c));
-		}
-	    }
-	    break;
-	}
-	cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
-    }
-    return result;
-}
-
 static void
 add_activated_refinement(VALUE activated_refinements,
 			 VALUE klass, VALUE refinement)
@@ -1228,8 +1198,6 @@
 	rb_ivar_set(refinement, id_refined_class, klass);
 	CONST_ID(id_defined_at, "__defined_at__");
 	rb_ivar_set(refinement, id_defined_at, module);
-	rb_define_singleton_method(refinement, "include",
-				   refinement_module_include, -1);
 	rb_hash_aset(refinements, klass, refinement);
 	add_activated_refinement(activated_refinements, klass, refinement);
     }

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

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