mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 12:33:56 +02:00
Remove the uninitialized instance variable verbose mode warning
This speeds up all instance variable access, even when not in verbose mode. Uninitialized instance variable warnings were rarely helpful, and resulted in slower code if you wanted to avoid warnings when run in verbose mode. Implements [Feature #17055]
This commit is contained in:
parent
4a559aa225
commit
01b7d5acc7
Notes:
git
2020-12-11 03:16:30 +09:00
7 changed files with 12 additions and 24 deletions
|
@ -2401,7 +2401,7 @@ class TestModule < Test::Unit::TestCase
|
|||
|
||||
def test_uninitialized_instance_variable
|
||||
a = AttrTest.new
|
||||
assert_warning(/instance variable @ivar not initialized/) do
|
||||
assert_warning('') do
|
||||
assert_nil(a.ivar)
|
||||
end
|
||||
a.instance_variable_set(:@ivar, 42)
|
||||
|
@ -2410,7 +2410,7 @@ class TestModule < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
name = "@\u{5909 6570}"
|
||||
assert_warning(/instance variable #{name} not initialized/) do
|
||||
assert_warning('') do
|
||||
assert_nil(a.instance_eval(name))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue