mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_insnhelper.c (vm_get_ev_const): no-scope reference to toplevel
private constant has been prohibited incorrectly. * test/ruby/test_module.rb (test_toplevel_private_constant): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
934f537b45
commit
5b74e4f09e
3 changed files with 25 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Sat Jan 29 10:53:16 2011 Yusuke Endoh <mame@tsg.ne.jp>
|
||||||
|
|
||||||
|
* vm_insnhelper.c (vm_get_ev_const): no-scope reference to toplevel
|
||||||
|
private constant has been prohibited incorrectly.
|
||||||
|
|
||||||
|
* test/ruby/test_module.rb (test_toplevel_private_constant): add a
|
||||||
|
test for above.
|
||||||
|
|
||||||
Sat Jan 29 08:43:23 2011 Ryan Davis <ryand-ruby@zenspider.com>
|
Sat Jan 29 08:43:23 2011 Ryan Davis <ryand-ruby@zenspider.com>
|
||||||
|
|
||||||
* lib/rubygems*: Import rubygems 1.5.0 (release candidate @ 09893d9)
|
* lib/rubygems*: Import rubygems 1.5.0 (release candidate @ 09893d9)
|
||||||
|
|
|
@ -985,4 +985,19 @@ class TestModule < Test::Unit::TestCase
|
||||||
def test_constants_with_private_constant
|
def test_constants_with_private_constant
|
||||||
assert(!(::TestModule).constants.include?(:PrivateClass))
|
assert(!(::TestModule).constants.include?(:PrivateClass))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_toplevel_private_constant
|
||||||
|
src = <<-INPUT
|
||||||
|
class Object
|
||||||
|
private_constant :Object
|
||||||
|
end
|
||||||
|
p Object
|
||||||
|
begin
|
||||||
|
p ::Object
|
||||||
|
rescue
|
||||||
|
p :ok
|
||||||
|
end
|
||||||
|
INPUT
|
||||||
|
assert_in_out_err([], src, %w(Object :ok), [])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1199,10 +1199,10 @@ vm_get_ev_const(rb_thread_t *th, const rb_iseq_t *iseq,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_defined) {
|
if (is_defined) {
|
||||||
return rb_public_const_defined(klass, id);
|
return rb_const_defined(klass, id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return rb_public_const_get(klass, id);
|
return rb_const_get(klass, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue