mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (bvar): block-local variable can shadow outer variable.
[ruby-core:13036] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2ae60f1634
commit
f3cbb20b22
2 changed files with 15 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Oct 29 18:42:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y (bvar): block-local variable can shadow outer variable.
|
||||||
|
[ruby-core:13036]
|
||||||
|
|
||||||
Mon Oct 29 17:58:16 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Mon Oct 29 17:58:16 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_substr): perfomance improvement. [ruby-dev:31806]
|
* string.c (rb_str_substr): perfomance improvement. [ruby-dev:31806]
|
||||||
|
|
13
parse.y
13
parse.y
|
@ -669,7 +669,7 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
|
||||||
%type <node> brace_block cmd_brace_block do_block lhs none fitem
|
%type <node> brace_block cmd_brace_block do_block lhs none fitem
|
||||||
%type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner
|
%type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner
|
||||||
%type <id> fsym variable sym symbol operation operation2 operation3
|
%type <id> fsym variable sym symbol operation operation2 operation3
|
||||||
%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg
|
%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_bad_arg
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
/*%
|
/*%
|
||||||
%type <val> program reswords then do dot_or_colon
|
%type <val> program reswords then do dot_or_colon
|
||||||
|
@ -3250,7 +3250,7 @@ bv_decls : bvar
|
||||||
%*/
|
%*/
|
||||||
;
|
;
|
||||||
|
|
||||||
bvar : f_norm_arg
|
bvar : tIDENTIFIER
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
new_bv($1);
|
new_bv($1);
|
||||||
|
@ -3258,6 +3258,10 @@ bvar : f_norm_arg
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
|
| f_bad_arg
|
||||||
|
{
|
||||||
|
$$ = 0;
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
lambda : {
|
lambda : {
|
||||||
|
@ -4135,7 +4139,7 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
f_norm_arg : tCONSTANT
|
f_bad_arg : tCONSTANT
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
yyerror("formal argument cannot be a constant");
|
yyerror("formal argument cannot be a constant");
|
||||||
|
@ -4171,6 +4175,9 @@ f_norm_arg : tCONSTANT
|
||||||
$$ = dispatch1(param_error, $1);
|
$$ = dispatch1(param_error, $1);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
f_norm_arg : f_bad_arg
|
||||||
| tIDENTIFIER
|
| tIDENTIFIER
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue