aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-08-11 16:22:58 -0700
committerJeremy Evans <code@jeremyevans.net>2019-10-17 09:32:06 -0700
commit0162e7e6471b639dfeeded29943e9e27c9519826 (patch)
tree7d3a205ed67f999bda5ffd755287a318a7e5fc88 /parse.y
parentfdfb5100b9e74cfb89b6de3649e98cb1ad85497a (diff)
downloadruby-0162e7e6471b639dfeeded29943e9e27c9519826.tar.gz
Make circular argument reference a SyntaxError instead of a warning
Fixes [Bug #10314]
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y6
1 files changed, 4 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index f9de9513e7..8e65bf775b 100644
--- a/parse.y
+++ b/parse.y
@@ -9890,7 +9890,8 @@ gettable(struct parser_params *p, ID id, const YYLTYPE *loc)
if (dyna_in_block(p) && dvar_defined_ref(p, id, &vidp)) {
if (NUMPARAM_ID_P(id) && numparam_nested_p(p)) return 0;
if (id == p->cur_arg) {
- rb_warn1("circular argument reference - %"PRIsWARN, rb_id2str(id));
+ compile_error(p, "circular argument reference - %"PRIsWARN, rb_id2str(id));
+ return 0;
}
if (vidp) *vidp |= LVAR_USED;
node = NEW_DVAR(id, loc);
@@ -9898,7 +9899,8 @@ gettable(struct parser_params *p, ID id, const YYLTYPE *loc)
}
if (local_id_ref(p, id, &vidp)) {
if (id == p->cur_arg) {
- rb_warn1("circular argument reference - %"PRIsWARN, rb_id2str(id));
+ compile_error(p, "circular argument reference - %"PRIsWARN, rb_id2str(id));
+ return 0;
}
if (vidp) *vidp |= LVAR_USED;
node = NEW_LVAR(id, loc);