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

ruby-changes:38709

From: ko1 <ko1@a...>
Date: Sat, 6 Jun 2015 15:07:20 +0900 (JST)
Subject: [ruby-changes:38709] ko1:r50790 (trunk): * class.c (ins_methods_push): Change type and name of parameters

ko1	2015-06-06 15:07:06 +0900 (Sat, 06 Jun 2015)

  New Revision: 50790

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

  Log:
    * class.c (ins_methods_push): Change type and name of parameters
      to make more clear.

  Modified files:
    trunk/ChangeLog
    trunk/class.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50789)
+++ ChangeLog	(revision 50790)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jun  6 15:05:47 2015  Koichi Sasada  <ko1@a...>
+
+	* class.c (ins_methods_push): Change type and name of parameters
+	  to make more clear.
+
 Sat Jun  6 08:52:13 2015  Eric Wong  <e@8...>
 
 	* test/socket/test_nonblock.rb: try to avoid EMSGSIZE
Index: class.c
===================================================================
--- class.c	(revision 50789)
+++ class.c	(revision 50790)
@@ -1065,32 +1065,27 @@ rb_mod_ancestors(VALUE mod) https://github.com/ruby/ruby/blob/trunk/class.c#L1065
 }
 
 static int
-ins_methods_push(ID name, long type, VALUE ary, rb_method_visibility_t visi)
+ins_methods_push(ID name, rb_method_visibility_t visi, VALUE ary, rb_method_visibility_t expected_visi)
 {
-    if (type == METHOD_VISI_UNDEF) return ST_CONTINUE;
+    if (visi == METHOD_VISI_UNDEF) return ST_CONTINUE;
 
-    switch (visi) {
+    switch (expected_visi) {
       case METHOD_VISI_UNDEF:
-	return ST_CONTINUE;
+	if (visi != METHOD_VISI_PRIVATE) rb_ary_push(ary, ID2SYM(name));
+	break;
       case METHOD_VISI_PRIVATE:
       case METHOD_VISI_PROTECTED:
       case METHOD_VISI_PUBLIC:
-	visi = (type == (long)visi);
-	break;
-      default:
-	visi = (type != METHOD_VISI_PRIVATE);
+	if (visi == expected_visi) rb_ary_push(ary, ID2SYM(name));
 	break;
     }
-    if (visi) {
-	rb_ary_push(ary, ID2SYM(name));
-    }
     return ST_CONTINUE;
 }
 
 static int
 ins_methods_i(st_data_t name, st_data_t type, st_data_t ary)
 {
-    return ins_methods_push((ID)name, (rb_method_visibility_t)type, (VALUE)ary, -1); /* everything but private */
+    return ins_methods_push((ID)name, (rb_method_visibility_t)type, (VALUE)ary, METHOD_VISI_UNDEF); /* everything but private */
 }
 
 static int

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

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