summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-06 06:07:06 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-06 06:07:06 (GMT)
commit1f9af2a9530073951c6f63b1ab9d1d2c6f14c177 (patch)
treebcf78aec6ad5cdc6ffe88bb6cc683c96b8c8d095 /class.c
parent32a586d7381a2cd23913a787340927ec189417d1 (diff)
* class.c (ins_methods_push): Change type and name of parameters
to make more clear. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/class.c b/class.c
index 3ac2d81..985b6a0 100644
--- a/class.c
+++ b/class.c
@@ -1065,24 +1065,19 @@ rb_mod_ancestors(VALUE mod)
}
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);
+ if (visi == expected_visi) rb_ary_push(ary, ID2SYM(name));
break;
- default:
- visi = (type != METHOD_VISI_PRIVATE);
- break;
- }
- if (visi) {
- rb_ary_push(ary, ID2SYM(name));
}
return ST_CONTINUE;
}
@@ -1090,7 +1085,7 @@ ins_methods_push(ID name, long type, VALUE ary, rb_method_visibility_t visi)
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