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

ruby-changes:37141

From: nobu <ko1@a...>
Date: Mon, 12 Jan 2015 17:18:19 +0900 (JST)
Subject: [ruby-changes:37141] nobu:r49222 (trunk): method.h: UNDEFINED_REFINED_METHOD_P

nobu	2015-01-12 17:18:10 +0900 (Mon, 12 Jan 2015)

  New Revision: 49222

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

  Log:
    method.h: UNDEFINED_REFINED_METHOD_P
    
    * method.h (UNDEFINED_REFINED_METHOD_P): macro to tell if refined
      original method is defined.

  Modified files:
    trunk/method.h
    trunk/vm_method.c
Index: method.h
===================================================================
--- method.h	(revision 49221)
+++ method.h	(revision 49222)
@@ -108,6 +108,9 @@ struct unlinked_method_entry_list_entry https://github.com/ruby/ruby/blob/trunk/method.h#L108
 };
 
 #define UNDEFINED_METHOD_ENTRY_P(me) (!(me) || !(me)->def || (me)->def->type == VM_METHOD_TYPE_UNDEF)
+#define UNDEFINED_REFINED_METHOD_P(def) \
+    ((def)->type == VM_METHOD_TYPE_REFINED && \
+     UNDEFINED_METHOD_ENTRY_P((def)->body.orig_me))
 
 void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex);
 rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex);
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 49221)
+++ vm_method.c	(revision 49222)
@@ -831,8 +831,7 @@ rb_export_method(VALUE klass, ID name, r https://github.com/ruby/ruby/blob/trunk/vm_method.c#L831
     }
 
     if (UNDEFINED_METHOD_ENTRY_P(me) ||
-	(me->def->type == VM_METHOD_TYPE_REFINED &&
-	 UNDEFINED_METHOD_ENTRY_P(me->def->body.orig_me))) {
+	UNDEFINED_REFINED_METHOD_P(me->def)) {
 	rb_print_undef(klass, name, 0);
     }
 
@@ -931,8 +930,7 @@ rb_undef(VALUE klass, ID id) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L930
     me = search_method(klass, id, 0);
 
     if (UNDEFINED_METHOD_ENTRY_P(me) ||
-	(me->def->type == VM_METHOD_TYPE_REFINED &&
-	 UNDEFINED_METHOD_ENTRY_P(me->def->body.orig_me))) {
+	UNDEFINED_REFINED_METHOD_P(me->def)) {
 	const char *s0 = " class";
 	VALUE c = klass;
 
@@ -1279,8 +1277,7 @@ rb_alias(VALUE klass, ID name, ID def) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1277
     orig_me = search_method(klass, def, &defined_class);
 
     if (UNDEFINED_METHOD_ENTRY_P(orig_me) ||
-	(orig_me->def->type == VM_METHOD_TYPE_REFINED &&
-	 UNDEFINED_METHOD_ENTRY_P(orig_me->def->body.orig_me))) {
+	UNDEFINED_REFINED_METHOD_P(orig_me->def)) {
 	if ((!RB_TYPE_P(klass, T_MODULE)) ||
 	    (orig_me = search_method(rb_cObject, def, 0),
 	     UNDEFINED_METHOD_ENTRY_P(orig_me))) {

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

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