summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-29 14:24:24 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-29 14:24:24 +0000
commit6fe9b2b79446e20e4a3a48c898313c63258182d5 (patch)
treea45bc1c90151fc2378d4db87856a48b4e23e386b /parse.y
parent98ea62756142b6c9cc030e99b6d936d986ce463c (diff)
parse.y: warn iside a block
* parse.y (gettable_gen): also warn circular argument reference even inside a block. [ruby-core:65990] [Bug #10314] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y7
1 files changed, 6 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index b256633189..da91b53a02 100644
--- a/parse.y
+++ b/parse.y
@@ -8733,7 +8733,12 @@ gettable_gen(struct parser_params *parser, ID id)
}
switch (id_type(id)) {
case ID_LOCAL:
- if (dyna_in_block() && dvar_defined(id)) return NEW_DVAR(id);
+ if (dyna_in_block() && dvar_defined(id)) {
+ if (id == current_arg) {
+ rb_warnV("circular argument reference - %"PRIsVALUE, rb_id2str(id));
+ }
+ return NEW_DVAR(id);
+ }
if (local_id(id)) {
if (id == current_arg) {
rb_warnV("circular argument reference - %"PRIsVALUE, rb_id2str(id));