mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (rb_call0): fixed bug of zsuper with both of opt and rest.
fixed: [ruby-list:42928] * test/ruby/test_super.rb: add tests to check above bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c26a1e6807
commit
8c61368971
3 changed files with 32 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Wed Nov 1 01:05:13 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (rb_call0): fixed bug of zsuper with both of opt and rest.
|
||||||
|
fixed: [ruby-list:42928]
|
||||||
|
|
||||||
|
* test/ruby/test_super.rb: add tests to check above bug.
|
||||||
|
|
||||||
Tue Oct 31 17:03:21 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Oct 31 17:03:21 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* time.c (time_dup): duplicate the class of original time.
|
* time.c (time_dup): duplicate the class of original time.
|
||||||
|
|
9
eval.c
9
eval.c
|
@ -5925,14 +5925,21 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags)
|
||||||
while (opt && argc) {
|
while (opt && argc) {
|
||||||
assign(recv, opt->nd_head, *argv, 1);
|
assign(recv, opt->nd_head, *argv, 1);
|
||||||
argv++; argc--;
|
argv++; argc--;
|
||||||
|
++i;
|
||||||
opt = opt->nd_next;
|
opt = opt->nd_next;
|
||||||
}
|
}
|
||||||
if (opt) {
|
if (opt) {
|
||||||
rb_eval(recv, opt);
|
rb_eval(recv, opt);
|
||||||
|
while (opt) {
|
||||||
|
opt = opt->nd_next;
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!node->nd_rest) {
|
||||||
i = nopt;
|
i = nopt;
|
||||||
}
|
}
|
||||||
if (node->nd_rest) {
|
else {
|
||||||
VALUE v;
|
VALUE v;
|
||||||
|
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
|
|
|
@ -43,6 +43,12 @@ class TestSuper < Test::Unit::TestCase
|
||||||
class Optional3 < Base
|
class Optional3 < Base
|
||||||
def single(a = 1) super end
|
def single(a = 1) super end
|
||||||
end
|
end
|
||||||
|
class Optional4 < Base
|
||||||
|
def array(a = 1, *) super end
|
||||||
|
end
|
||||||
|
class Optional5 < Base
|
||||||
|
def array(a = 1, b = 2, *) super end
|
||||||
|
end
|
||||||
|
|
||||||
def test_single1
|
def test_single1
|
||||||
assert_equal(1, Single1.new.single(1))
|
assert_equal(1, Single1.new.single(1))
|
||||||
|
@ -94,6 +100,17 @@ class TestSuper < Test::Unit::TestCase
|
||||||
# call Base#single with 1 argument; the arg is supplied
|
# call Base#single with 1 argument; the arg is supplied
|
||||||
assert_equal(1, Optional3.new.single)
|
assert_equal(1, Optional3.new.single)
|
||||||
end
|
end
|
||||||
|
def test_optional4
|
||||||
|
assert_equal([1], Optional4.new.array)
|
||||||
|
assert_equal([9], Optional4.new.array(9))
|
||||||
|
assert_equal([9, 8], Optional4.new.array(9, 8))
|
||||||
|
end
|
||||||
|
def test_optional5
|
||||||
|
assert_equal([1, 2], Optional5.new.array)
|
||||||
|
assert_equal([9, 2], Optional5.new.array(9))
|
||||||
|
assert_equal([9, 8], Optional5.new.array(9, 8))
|
||||||
|
assert_equal([9, 8, 7], Optional5.new.array(9, 8, 7))
|
||||||
|
end
|
||||||
|
|
||||||
class A
|
class A
|
||||||
def tt(aa)
|
def tt(aa)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue