diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-25 03:47:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-25 03:47:46 +0000 |
commit | f5f6218a23fdbe45d1a80c202a131f02c3eef0ce (patch) | |
tree | 97c75e272f700fa4df8691b571d7e0db15df8100 /test/ruby/test_parse.rb | |
parent | ce59e249a562c8dded6482bc986d72fe34119bff (diff) | |
download | ruby-f5f6218a23fdbe45d1a80c202a131f02c3eef0ce.tar.gz |
parse.y: warn past scope variable
* parse.y (gettable_gen): warn possible reference to a local
variable defined in a past scope.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_parse.rb')
-rw-r--r-- | test/ruby/test_parse.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 70b38a2a7e..38dca83053 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -873,4 +873,8 @@ x = __ENCODING__ a = "\u{3042}" assert_warning(/#{a}/) {eval("#{a} = 1; /(?<#{a}>)/ =~ ''")} end + + def test_past_scope_variable + assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}} + end end |