mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_eval.c: exclude hidden variables
* vm_eval.c (rb_f_local_variables): exclude variables hidden by shadowing. [ruby-core:60501] [Bug #9486] * vm.c (collect_local_variables_in_iseq): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c8dbc43de6
commit
11eb870136
4 changed files with 15 additions and 6 deletions
|
@ -86,13 +86,13 @@ class TestVariable < Test::Unit::TestCase
|
|||
def test_shadowing_local_variables
|
||||
bug9486 = '[ruby-core:60501] [Bug #9486]'
|
||||
x = tap {|x| break local_variables}
|
||||
assert_equal([:x, :bug9486, :x], x)
|
||||
assert_equal([:x, :bug9486], x)
|
||||
end
|
||||
|
||||
def test_shadowing_block_local_variables
|
||||
bug9486 = '[ruby-core:60501] [Bug #9486]'
|
||||
x = tap {|;x| break local_variables}
|
||||
assert_equal([:x, :bug9486, :x], x)
|
||||
assert_equal([:x, :bug9486], x)
|
||||
end
|
||||
|
||||
def local_variables_of(bind)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue