diff --git a/ChangeLog b/ChangeLog index 2af806b90c..6533c2538d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Aug 9 21:53:17 2005 Nobuyoshi Nakada + + * eval.c (formal_assign): let default values override + arguments to zsuper. fixed: [ruby-dev:26743] + Tue Aug 9 15:12:04 2005 Hidetoshi NAGAI * ext/tk/tcltklib.c: remove dangerous 'rb_jump_tag's. @@ -5,11 +10,11 @@ Tue Aug 9 15:12:04 2005 Hidetoshi NAGAI * ext/tk/lib/tk.rb: add __val2ruby_optkeys and __ruby2val_optkeys to help to convert option values between ruby and tcl. - * ext/tk/lib/tk/itemconfig.rb: add __item_val2ruby_optkeys and - __item_ruby2val_optkeys to help to convert option values between + * ext/tk/lib/tk/itemconfig.rb: add __item_val2ruby_optkeys and + __item_ruby2val_optkeys to help to convert option values between ruby and tcl. - * ext/tk/lib/tk/radiobutton.rb: use __ruby2val_optkeys for 'variable' + * ext/tk/lib/tk/radiobutton.rb: use __ruby2val_optkeys for 'variable' option (for the reason of backward compatibility). * ext/tk/lib/tk/composite.rb: clarify the arguments of super(). diff --git a/eval.c b/eval.c index 4354765cb5..0ce62fd3b7 100644 --- a/eval.c +++ b/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; }