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
This commit is contained in:
nobu 2014-12-25 03:47:46 +00:00
parent ce59e249a5
commit f5f6218a23
3 changed files with 34 additions and 2 deletions

View file

@ -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