mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* proc.c (missing_wrap): reverted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a943745a42
commit
9d72cb269c
3 changed files with 5 additions and 5 deletions
|
@ -1,6 +1,4 @@
|
||||||
Fri Sep 25 13:05:50 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Sep 25 13:04:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* proc.c (missing_wrap): new_arg is already given if argc > 1.
|
|
||||||
|
|
||||||
* proc.c (mnew): fix for instance method of Module, BasicObjec
|
* proc.c (mnew): fix for instance method of Module, BasicObjec
|
||||||
and subclass of a class which overrides respond_to_missing?.
|
and subclass of a class which overrides respond_to_missing?.
|
||||||
|
|
4
proc.c
4
proc.c
|
@ -884,12 +884,12 @@ rb_obj_is_method(VALUE m)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
missing_wrap(VALUE new_args, VALUE args, int argc, VALUE *argv)
|
missing_wrap(VALUE dummy, VALUE args, int argc, VALUE *argv)
|
||||||
{
|
{
|
||||||
|
VALUE new_args = rb_ary_new4(argc, argv);
|
||||||
VALUE obj = RARRAY_PTR(args)[0];
|
VALUE obj = RARRAY_PTR(args)[0];
|
||||||
VALUE sym = RARRAY_PTR(args)[1];
|
VALUE sym = RARRAY_PTR(args)[1];
|
||||||
|
|
||||||
if (argc <= 1) new_args = rb_ary_new4(argc, argv);
|
|
||||||
rb_ary_unshift(new_args, sym);
|
rb_ary_unshift(new_args, sym);
|
||||||
return rb_funcall2(obj, rb_intern("method_missing"),
|
return rb_funcall2(obj, rb_intern("method_missing"),
|
||||||
check_argc(RARRAY_LEN(new_args)), RARRAY_PTR(new_args));
|
check_argc(RARRAY_LEN(new_args)), RARRAY_PTR(new_args));
|
||||||
|
|
|
@ -325,6 +325,7 @@ class TestObject < Test::Unit::TestCase
|
||||||
foo = c.new
|
foo = c.new
|
||||||
assert_equal([:foo], foo.foobar);
|
assert_equal([:foo], foo.foobar);
|
||||||
assert_equal([:foo, 1], foo.foobar(1));
|
assert_equal([:foo, 1], foo.foobar(1));
|
||||||
|
assert_equal([:foo, 1, 2, 3, 4, 5], foo.foobar(1, 2, 3, 4, 5));
|
||||||
assert(foo.respond_to?(:foobar))
|
assert(foo.respond_to?(:foobar))
|
||||||
assert_equal(false, foo.respond_to?(:foobarbaz))
|
assert_equal(false, foo.respond_to?(:foobarbaz))
|
||||||
assert_raise(NoMethodError) do
|
assert_raise(NoMethodError) do
|
||||||
|
@ -334,6 +335,7 @@ class TestObject < Test::Unit::TestCase
|
||||||
foobar = foo.method(:foobar)
|
foobar = foo.method(:foobar)
|
||||||
assert_equal([:foo], foobar.call);
|
assert_equal([:foo], foobar.call);
|
||||||
assert_equal([:foo, 1], foobar.call(1));
|
assert_equal([:foo, 1], foobar.call(1));
|
||||||
|
assert_equal([:foo, 1, 2, 3, 4, 5], foobar.call(1, 2, 3, 4, 5));
|
||||||
|
|
||||||
c = Class.new(c)
|
c = Class.new(c)
|
||||||
assert_equal(false, c.method_defined?(:foobar))
|
assert_equal(false, c.method_defined?(:foobar))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue