diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-28 17:57:48 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-28 17:57:48 +0000 |
commit | b511e1bfbe649b938e317e00ad1795f1b9623758 (patch) | |
tree | 708e4697a565a72dcc1f2a9805ba2d99bcd79e23 /variable.c | |
parent | b1e829fb30be8a1a5c842a981ed9eacf9c77b1a3 (diff) | |
download | bundler-b511e1bfbe649b938e317e00ad1795f1b9623758.tar.gz |
* variable.c (rb_mod_const_of, sv_i): Module#constant should exclude
private constants. see [ruby-core:32912].
* test/ruby/test_module.rb (test_constants_with_private_constant): add
a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/variable.c b/variable.c index 1ee299e358..daaf4e2d56 100644 --- a/variable.c +++ b/variable.c @@ -1709,7 +1709,7 @@ sv_i(ID key, rb_const_entry_t *ce, st_table *tbl) { if (rb_is_const_id(key)) { if (!st_lookup(tbl, (st_data_t)key, 0)) { - st_insert(tbl, (st_data_t)key, (st_data_t)key); + st_insert(tbl, (st_data_t)key, (st_data_t)ce); } } return ST_CONTINUE; @@ -1742,9 +1742,11 @@ rb_mod_const_of(VALUE mod, void *data) } static int -list_i(ID key, ID value, VALUE ary) +list_i(st_data_t key, st_data_t value, VALUE ary) { - rb_ary_push(ary, ID2SYM(key)); + ID sym = (ID)key; + rb_const_entry_t *ce = (rb_const_entry_t *)value; + if (ce->flag != CONST_PRIVATE) rb_ary_push(ary, ID2SYM(sym)); return ST_CONTINUE; } |