variable.c: exclude private constants
* variable.c (rb_local_constants_i): exclude private constants when excluding inherited constants too. [Bug #12345] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0fc6877ed5
commit
6ea002a7a2
@ -1,3 +1,8 @@
|
|||||||
|
Tue Jul 19 15:38:59 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* variable.c (rb_local_constants_i): exclude private constants
|
||||||
|
when excluding inherited constants too. [Bug #12345]
|
||||||
|
|
||||||
Sun Jul 17 23:42:00 2016 Kenta Murata <mrkn@mrkn.jp>
|
Sun Jul 17 23:42:00 2016 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
* numeric.c (num_finite_p, num_infinite_p): Add Numeric#finite? and
|
* numeric.c (num_finite_p, num_infinite_p): Add Numeric#finite? and
|
||||||
|
@ -1423,6 +1423,8 @@ class TestModule < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_constants_with_private_constant
|
def test_constants_with_private_constant
|
||||||
assert_not_include(::TestModule.constants, :PrivateClass)
|
assert_not_include(::TestModule.constants, :PrivateClass)
|
||||||
|
assert_not_include(::TestModule.constants(true), :PrivateClass)
|
||||||
|
assert_not_include(::TestModule.constants(false), :PrivateClass)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_toplevel_private_constant
|
def test_toplevel_private_constant
|
||||||
|
@ -2399,7 +2399,7 @@ sv_i(ID key, VALUE v, void *a)
|
|||||||
static enum rb_id_table_iterator_result
|
static enum rb_id_table_iterator_result
|
||||||
rb_local_constants_i(ID const_name, VALUE const_value, void *ary)
|
rb_local_constants_i(ID const_name, VALUE const_value, void *ary)
|
||||||
{
|
{
|
||||||
if (rb_is_const_id(const_name)) {
|
if (rb_is_const_id(const_name) && !RB_CONST_PRIVATE_P((rb_const_entry_t *)const_value)) {
|
||||||
rb_ary_push((VALUE)ary, ID2SYM(const_name));
|
rb_ary_push((VALUE)ary, ID2SYM(const_name));
|
||||||
}
|
}
|
||||||
return ID_TABLE_CONTINUE;
|
return ID_TABLE_CONTINUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user