mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: handle "duplicated argument name" appropriately on ripper.y
refs: 733ed1e184
This commit is contained in:
parent
1a3343cfdc
commit
7ff0e93f96
2 changed files with 5 additions and 2 deletions
6
parse.y
6
parse.y
|
@ -7871,7 +7871,9 @@ formal_argument(struct parser_params *p, ID lhs)
|
|||
formal_argument(struct parser_params *p, VALUE lhs)
|
||||
#endif
|
||||
{
|
||||
switch (id_type(get_id(lhs))) {
|
||||
ID id = get_id(lhs);
|
||||
|
||||
switch (id_type(id)) {
|
||||
case ID_LOCAL:
|
||||
break;
|
||||
#ifndef RIPPER
|
||||
|
@ -7896,7 +7898,7 @@ formal_argument(struct parser_params *p, VALUE lhs)
|
|||
return 0;
|
||||
#undef ERR
|
||||
}
|
||||
shadowing_lvar(p, lhs);
|
||||
shadowing_lvar(p, id);
|
||||
return lhs;
|
||||
}
|
||||
|
||||
|
|
|
@ -148,6 +148,7 @@ class TestRipper::Lexer < Test::Unit::TestCase
|
|||
|
||||
BAD_CODE = [
|
||||
[:parse_error, 'def req(true) end', %r[unexpected `true'], 'true'],
|
||||
[:parse_error, 'def req(a, a) end', %r[duplicated argument name], 'a'],
|
||||
[:assign_error, 'begin; nil = 1; end', %r[assign to nil], 'nil'],
|
||||
[:alias_error, 'begin; alias $x $1; end', %r[number variables], '$1'],
|
||||
[:class_name_error, 'class bad; end', %r[class/module name], 'bad'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue