mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
compile.c: disallow private readers
* compile.c (iseq_compile_each): revert r46873 and r46875, not to allow to execute private readers by pretending op assign. [ruby-core:68984] [Bug #11096] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0e42b43497
commit
7132479960
3 changed files with 16 additions and 11 deletions
|
@ -102,7 +102,7 @@ class TestAssignment < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_assign_private_self
|
||||
bug9907 = '[ruby-core:62949] [Bug #9907]'
|
||||
bug11096 = '[ruby-core:68984] [Bug #11096]'
|
||||
|
||||
o = Object.new
|
||||
class << o
|
||||
|
@ -127,17 +127,17 @@ class TestAssignment < Test::Unit::TestCase
|
|||
assert_equal(1, o.instance_eval {self[0] = 1})
|
||||
}
|
||||
|
||||
assert_nothing_raised(NoMethodError, bug9907) {
|
||||
assert_raise(NoMethodError, bug11096) {
|
||||
assert_equal(43, o.instance_eval {self.foo += 1})
|
||||
}
|
||||
assert_nothing_raised(NoMethodError, bug9907) {
|
||||
assert_raise(NoMethodError, bug11096) {
|
||||
assert_equal(1, o.instance_eval {self.foo &&= 1})
|
||||
}
|
||||
|
||||
assert_nothing_raised(NoMethodError, bug9907) {
|
||||
assert_raise(NoMethodError, bug11096) {
|
||||
assert_equal(43, o.instance_eval {self[0] += 1})
|
||||
}
|
||||
assert_nothing_raised(NoMethodError, bug9907) {
|
||||
assert_raise(NoMethodError, bug11096) {
|
||||
assert_equal(1, o.instance_eval {self[0] &&= 1})
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue