summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-09 12:53:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-09 12:53:38 +0000
commit185a97d8a8457d4791b995f0133e6749b3de4568 (patch)
tree94bc057d11c9092ca6bfd7c07bc134bf2298e843
parentadde1e913d960dff1cfdc54b51a7a40322faddc9 (diff)
downloadruby-185a97d8a8457d4791b995f0133e6749b3de4568.tar.gz
ruby-185a97d8a8457d4791b995f0133e6749b3de4568.tar.xz
ruby-185a97d8a8457d4791b995f0133e6749b3de4568.zip
* eval.c (formal_assign): let default values override
arguments to zsuper. fixed: [ruby-dev:26743] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--eval.c16
2 files changed, 19 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 2af806b90..6533c2538 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
@@ -5,11 +10,11 @@ Tue Aug 9 15:12:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* 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 4354765cb..0ce62fd3b 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;
}