summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-13 09:10:55 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-13 09:10:55 +0000
commit8a3d25a790e0aecd9e7e2478e3a27362e47a920b (patch)
tree8820bbe1bb80a8ce542b3e6105fcd7c306d38502 /parse.y
parentfdbf3a76a18d6282953a2a7d3a6af222f6fa1be2 (diff)
* eval.c (rb_call0): argument update propagation. [ruby-dev:28044]
* env.h: remove argc member from struct FRAME. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y28
1 files changed, 17 insertions, 11 deletions
diff --git a/parse.y b/parse.y
index bd2039822c..56232fa9f1 100644
--- a/parse.y
+++ b/parse.y
@@ -275,12 +275,12 @@ static void top_local_setup();
%type <node> args when_args call_args call_args2 open_args paren_args opt_paren_args
%type <node> command_args aref_args opt_block_arg block_arg var_ref var_lhs
%type <node> mrhs superclass block_call block_command
-%type <node> f_arglist f_args f_optarg f_opt f_block_arg opt_f_block_arg
+%type <node> f_arglist f_args f_optarg f_opt f_rest_arg f_block_arg opt_f_block_arg
%type <node> assoc_list assocs assoc undef_list backref string_dvar
%type <node> block_var opt_block_var brace_block cmd_brace_block do_block lhs none fitem
%type <node> mlhs mlhs_head mlhs_basic mlhs_entry mlhs_item mlhs_node
%type <id> fsym variable sym symbol operation operation2 operation3
-%type <id> cname fname op f_rest_arg
+%type <id> cname fname op
%type <num> f_norm_arg f_arg
%token tUPLUS /* unary+ */
%token tUMINUS /* unary- */
@@ -2249,7 +2249,7 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
}
| f_arg ',' f_optarg opt_f_block_arg
{
- $$ = block_append(NEW_ARGS($1, $3, -1), $4);
+ $$ = block_append(NEW_ARGS($1, $3, 0), $4);
}
| f_arg ',' f_rest_arg opt_f_block_arg
{
@@ -2257,7 +2257,7 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
}
| f_arg opt_f_block_arg
{
- $$ = block_append(NEW_ARGS($1, 0, -1), $2);
+ $$ = block_append(NEW_ARGS($1, 0, 0), $2);
}
| f_optarg ',' f_rest_arg opt_f_block_arg
{
@@ -2265,7 +2265,7 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
}
| f_optarg opt_f_block_arg
{
- $$ = block_append(NEW_ARGS(0, $1, -1), $2);
+ $$ = block_append(NEW_ARGS(0, $1, 0), $2);
}
| f_rest_arg opt_f_block_arg
{
@@ -2273,11 +2273,11 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
}
| f_block_arg
{
- $$ = block_append(NEW_ARGS(0, 0, -1), $1);
+ $$ = block_append(NEW_ARGS(0, 0, 0), $1);
}
| /* none */
{
- $$ = NEW_ARGS(0, 0, -1);
+ $$ = NEW_ARGS(0, 0, 0);
}
;
@@ -2344,13 +2344,19 @@ f_rest_arg : restarg_mark tIDENTIFIER
{
if (!is_local_id($2))
yyerror("rest argument must be local variable");
- else if (local_id($2))
- yyerror("duplicate rest argument name");
- $$ = local_cnt($2);
+ if (dyna_in_block()) {
+ rb_dvar_push($2, Qnil);
+ }
+ $$ = assignable($2, 0);
}
| restarg_mark
{
- $$ = -2;
+ if (dyna_in_block()) {
+ $$ = NEW_DASGN_CURR(internal_id(), 0);
+ }
+ else {
+ $$ = NEW_NODE(NODE_LASGN,0,0,local_append(0));
+ }
}
;