diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-08-11 16:22:58 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-10-17 09:32:06 -0700 |
commit | 0162e7e6471b639dfeeded29943e9e27c9519826 (patch) | |
tree | 7d3a205ed67f999bda5ffd755287a318a7e5fc88 /parse.y | |
parent | fdfb5100b9e74cfb89b6de3649e98cb1ad85497a (diff) | |
download | ruby-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.y | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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); |