summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-01 20:16:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-01 20:16:53 +0000
commitcdacb127fc82920afed967222716d6775273432a (patch)
treee03d777bdac7dd2a882e7848a8b2f7c3b73f09ee /class.c
parentbaf02b9a6330acff09c80f27cfc2e7b8536f5f68 (diff)
* class.c (rb_obj_singleton_methods): should not go up to
ancestors unless the recursive flag is set. [ruby-list:38007] * hash.c (env_each_key): use env_keys to avoid environment modify on the fly. * hash.c (env_each_value): use env_values for safety. * hash.c (env_each): allocate environment array first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r--class.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/class.c b/class.c
index 24b2289..4d8db41 100644
--- a/class.c
+++ b/class.c
@@ -622,12 +622,12 @@ rb_obj_singleton_methods(argc, argv, obj)
}
klass = CLASS_OF(obj);
list = st_init_numtable();
- while (klass && FL_TEST(klass, FL_SINGLETON)) {
+ if (klass && FL_TEST(klass, FL_SINGLETON)) {
st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list);
klass = RCLASS(klass)->super;
}
if (RTEST(recur)) {
- while (klass && TYPE(klass) == T_ICLASS) {
+ while (klass && (FL_TEST(klass, FL_SINGLETON) || TYPE(klass) == T_ICLASS)) {
st_foreach(RCLASS(klass)->m_tbl, method_entry, (st_data_t)list);
klass = RCLASS(klass)->super;
}