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

ruby-changes:65468

From: S.H <ko1@a...>
Date: Sun, 21 Mar 2021 06:57:50 +0900 (JST)
Subject: [ruby-changes:65468] 54bfa0570d (master): Add ins_methods_type_i function

https://git.ruby-lang.org/ruby.git/commit/?id=54bfa0570d

From 54bfa0570d8dd2da0dbf8c8fc75b34b4cf6831a6 Mon Sep 17 00:00:00 2001
From: "S.H" <gamelinks007@g...>
Date: Sun, 21 Mar 2021 06:57:30 +0900
Subject: Add ins_methods_type_i function

---
 class.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/class.c b/class.c
index b2e15c2..e1e1ce0 100644
--- a/class.c
+++ b/class.c
@@ -1360,30 +1360,30 @@ ins_methods_i(st_data_t name, st_data_t type, st_data_t ary) https://github.com/ruby/ruby/blob/trunk/class.c#L1360
 }
 
 static int
-ins_methods_prot_i(st_data_t name, st_data_t type, st_data_t ary)
+ins_methods_type_i(st_data_t name, st_data_t type, st_data_t ary, rb_method_visibility_t visi)
 {
-    if ((rb_method_visibility_t)type == METHOD_VISI_PROTECTED) {
+    if ((rb_method_visibility_t)type == visi) {
 	ins_methods_push(name, ary);
     }
     return ST_CONTINUE;
 }
 
 static int
+ins_methods_prot_i(st_data_t name, st_data_t type, st_data_t ary)
+{
+    return ins_methods_type_i(name, type, ary, METHOD_VISI_PROTECTED);
+}
+
+static int
 ins_methods_priv_i(st_data_t name, st_data_t type, st_data_t ary)
 {
-    if ((rb_method_visibility_t)type == METHOD_VISI_PRIVATE) {
-	ins_methods_push(name, ary);
-    }
-    return ST_CONTINUE;
+    return ins_methods_type_i(name, type, ary, METHOD_VISI_PRIVATE);
 }
 
 static int
 ins_methods_pub_i(st_data_t name, st_data_t type, st_data_t ary)
 {
-    if ((rb_method_visibility_t)type == METHOD_VISI_PUBLIC) {
-	ins_methods_push(name, ary);
-    }
-    return ST_CONTINUE;
+    return ins_methods_type_i(name, type, ary, METHOD_VISI_PUBLIC);
 }
 
 struct method_entry_arg {
-- 
cgit v1.1


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

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