diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-09 12:53:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-08-09 12:53:38 +0000 |
commit | 0c624c4bf27198ddf20a25107deaed151a218b84 (patch) | |
tree | 94bc057d11c9092ca6bfd7c07bc134bf2298e843 | |
parent | c1566b74903da07910103c143cb2a38f4a7c86ba (diff) |
* 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
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | eval.c | 16 |
2 files changed, 19 insertions, 8 deletions
@@ -1,3 +1,8 @@ +Tue Aug 9 21:53:17 2005 Nobuyoshi Nakada <[email protected]> + + * eval.c (formal_assign): let default values override + arguments to zsuper. fixed: [ruby-dev:26743] + Tue Aug 9 15:12:04 2005 Hidetoshi NAGAI <[email protected]> * ext/tk/tcltklib.c: remove dangerous 'rb_jump_tag's. @@ -5,11 +10,11 @@ Tue Aug 9 15:12:04 2005 Hidetoshi NAGAI <[email protected]> * 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(). @@ -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; } |