mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (formal_assign): returns position of rest arguments variable.
* parse.y (f_rest_arg): use anonymous variable for rest arguments. fixed: [ruby-dev:26647] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c9a8baddbc
commit
710b99a16b
3 changed files with 19 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
|||
Fri Aug 5 00:08:44 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Fri Aug 5 00:18:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* enumerator.c (Init_Enumerator): provided features should have
|
||||
extensions.
|
||||
|
@ -9,6 +9,11 @@ Fri Aug 5 00:08:44 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|||
* eval.c (search_required): ruby library should be prior to statically
|
||||
linked extentions. fixed: [ruby-dev:26711]
|
||||
|
||||
* eval.c (formal_assign): returns position of rest arguments variable.
|
||||
|
||||
* parse.y (f_rest_arg): use anonymous variable for rest arguments.
|
||||
fixed: [ruby-dev:26647]
|
||||
|
||||
Thu Aug 4 20:03:18 2005 Tadashi Saito <shiba@mail2.accsnet.ne.jp>
|
||||
|
||||
* numeric.c (Init_Numeric): do not share implementation among
|
||||
|
|
14
eval.c
14
eval.c
|
@ -1105,7 +1105,7 @@ static VALUE module_setup _((VALUE,NODE*));
|
|||
|
||||
static VALUE massign _((VALUE,NODE*,VALUE,int));
|
||||
static void assign _((VALUE,NODE*,VALUE,int));
|
||||
static void formal_assign _((VALUE, NODE*, int, VALUE*, VALUE*));
|
||||
static int formal_assign _((VALUE, NODE*, int, VALUE*, VALUE*));
|
||||
|
||||
typedef struct event_hook {
|
||||
rb_event_hook_func_t func;
|
||||
|
@ -5715,7 +5715,7 @@ call_cfunc(func, recv, len, argc, argv)
|
|||
return Qnil; /* not reached */
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
formal_assign(recv, node, argc, argv, local_vars)
|
||||
VALUE recv;
|
||||
NODE *node;
|
||||
|
@ -5766,13 +5766,14 @@ formal_assign(recv, node, argc, argv, local_vars)
|
|||
while (opt && argc) {
|
||||
assign(recv, opt->nd_head, *argv, 1);
|
||||
argv++; argc--;
|
||||
++i;
|
||||
opt = opt->nd_next;
|
||||
}
|
||||
if (opt) {
|
||||
rb_eval(recv, opt);
|
||||
}
|
||||
}
|
||||
if (RTEST(node->nd_rest)) {
|
||||
if (node->nd_rest) {
|
||||
VALUE v;
|
||||
|
||||
if (argc > 0)
|
||||
|
@ -5780,7 +5781,9 @@ formal_assign(recv, node, argc, argv, local_vars)
|
|||
else
|
||||
v = rb_ary_new2(0);
|
||||
assign(recv, node->nd_rest, v, 1);
|
||||
if (argc > 0) return -i - 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -5923,10 +5926,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
|
|||
body = body->nd_next;
|
||||
}
|
||||
if (node) {
|
||||
formal_assign(recv, node, argc, argv, local_vars);
|
||||
if (RTEST(node->nd_rest)) {
|
||||
ruby_frame->argc = -(ruby_frame->argc - argc)-1;
|
||||
}
|
||||
ruby_frame->argc = formal_assign(recv, node, argc, argv, local_vars);
|
||||
}
|
||||
|
||||
if (event_hooks) {
|
||||
|
|
7
parse.y
7
parse.y
|
@ -4169,7 +4169,12 @@ f_rest_arg : restarg_mark tIDENTIFIER
|
|||
| restarg_mark
|
||||
{
|
||||
/*%%%*/
|
||||
$$ = (NODE*)Qnil;
|
||||
if (dyna_in_block()) {
|
||||
$$ = NEW_DASGN_CURR(internal_id(), 0);
|
||||
}
|
||||
else {
|
||||
$$ = NEW_NODE(NODE_LASGN,0,0,local_append(0));
|
||||
}
|
||||
/*%
|
||||
$$ = dispatch1(restparam, Qnil);
|
||||
%*/
|
||||
|
|
Loading…
Reference in a new issue