parse.y: Removes unreachable warnings

tIDENTIFIER is now always a local id (except fname).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-01-15 08:54:25 +00:00
parent 6bdd198937
commit 4d073d5377

43
parse.y
View File

@ -4453,10 +4453,6 @@ restarg_mark : '*'
f_rest_arg : restarg_mark tIDENTIFIER
{
/*%%%*/
if (!is_local_id($2))
yyerror1(&@2, "rest argument must be local variable");
/*% %*/
arg_var(p, shadowing_lvar(p, get_id($2)));
/*%%%*/
$$ = $2;
@ -4481,12 +4477,6 @@ blkarg_mark : '&'
f_block_arg : blkarg_mark tIDENTIFIER
{
/*%%%*/
if (!is_local_id($2))
yyerror1(&@2, "block argument must be local variable");
else if (!dyna_in_block(p) && local_id(p, $2))
yyerror1(&@2, "duplicated block argument name");
/*% %*/
arg_var(p, shadowing_lvar(p, get_id($2)));
/*%%%*/
$$ = $2;
@ -4522,25 +4512,20 @@ singleton : var_ref
| '(' {SET_LEX_STATE(EXPR_BEG);} expr rparen
{
/*%%%*/
if ($3 == 0) {
yyerror1(&@3, "can't define singleton method for ().");
}
else {
switch (nd_type($3)) {
case NODE_STR:
case NODE_DSTR:
case NODE_XSTR:
case NODE_DXSTR:
case NODE_DREGX:
case NODE_LIT:
case NODE_ARRAY:
case NODE_ZARRAY:
yyerror1(&@3, "can't define singleton method for literals");
break;
default:
value_expr($3);
break;
}
switch (nd_type($3)) {
case NODE_STR:
case NODE_DSTR:
case NODE_XSTR:
case NODE_DXSTR:
case NODE_DREGX:
case NODE_LIT:
case NODE_ARRAY:
case NODE_ZARRAY:
yyerror1(&@3, "can't define singleton method for literals");
break;
default:
value_expr($3);
break;
}
$$ = $3;
/*%