From 4d073d53773872633954dd1e57bd3a6f53545dfb Mon Sep 17 00:00:00 2001 From: mame Date: Mon, 15 Jan 2018 08:54:25 +0000 Subject: [PATCH] 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 --- parse.y | 43 ++++++++++++++----------------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/parse.y b/parse.y index c261cce71b..154c8c2af1 100644 --- a/parse.y +++ b/parse.y @@ -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; /*%