mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (formal_assign): let default values override
arguments to zsuper. fixed: [ruby-dev:26743] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c1566b7490
commit
0c624c4bf2
2 changed files with 19 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
|||
Tue Aug 9 21:53:17 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (formal_assign): let default values override
|
||||
arguments to zsuper. fixed: [ruby-dev:26743]
|
||||
|
||||
Tue Aug 9 15:12:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/tcltklib.c: remove dangerous 'rb_jump_tag's.
|
||||
|
|
16
eval.c
16
eval.c
|
@ -5731,6 +5731,7 @@ formal_assign(recv, node, argc, argv, local_vars)
|
|||
VALUE *local_vars;
|
||||
{
|
||||
int i;
|
||||
int nopt = 0;
|
||||
|
||||
if (nd_type(node) != NODE_ARGS) {
|
||||
rb_bug("no argument-node");
|
||||
|
@ -5741,9 +5742,9 @@ formal_assign(recv, node, argc, argv, local_vars)
|
|||
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, i);
|
||||
}
|
||||
if (!node->nd_rest) {
|
||||
int nopt = i;
|
||||
NODE *optnode = node->nd_opt;
|
||||
|
||||
nopt = i;
|
||||
while (optnode) {
|
||||
nopt++;
|
||||
optnode = optnode->nd_next;
|
||||
|
@ -5780,15 +5781,20 @@ formal_assign(recv, node, argc, argv, local_vars)
|
|||
rb_eval(recv, opt);
|
||||
}
|
||||
}
|
||||
if (node->nd_rest) {
|
||||
if (!node->nd_rest) {
|
||||
i = nopt;
|
||||
}
|
||||
else {
|
||||
VALUE v;
|
||||
|
||||
if (argc > 0)
|
||||
if (argc > 0) {
|
||||
v = rb_ary_new4(argc,argv);
|
||||
else
|
||||
i = -i - 1;
|
||||
}
|
||||
else {
|
||||
v = rb_ary_new2(0);
|
||||
}
|
||||
assign(recv, node->nd_rest, v, 1);
|
||||
if (argc > 0) return -i - 1;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue