summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-28 10:41:11 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-28 10:41:11 +0000
commit9050b61dcbee9bbd5ad9e494de65cd4cd3103af8 (patch)
treef541991858a80ab6c732115246080c65f2be471e
parent49991ff6f85455f57ee9495a082d85c68da7d63c (diff)
* proc.c (rb_method_entry_arity): support optimized method (send).
* test/ruby/test_method.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--proc.c8
-rw-r--r--test/ruby/test_method.rb4
3 files changed, 18 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2c54f2a0e5..c698c7da5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Jul 28 19:36:26 2009 Koichi Sasada <ko1@atdot.net>
+
+ * proc.c (rb_method_entry_arity): support optimized method (send).
+
+ * test/ruby/test_method.rb: add a test for above.
+
Tue Jul 28 04:34:05 2009 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/extconf.rb: bug fix and ignore invalid Tcl/Tk libraries.
diff --git a/proc.c b/proc.c
index 9536ee63bf..3b83b17c3b 100644
--- a/proc.c
+++ b/proc.c
@@ -1487,6 +1487,14 @@ rb_method_entry_arity(const rb_method_entry_t *me)
return -(iseq->argc + 1 + iseq->arg_post_len);
}
}
+ case VM_METHOD_TYPE_OPTIMIZED: {
+ switch (me->body.optimize_type) {
+ case OPTIMIZED_METHOD_TYPE_SEND:
+ return -1;
+ default:
+ break;
+ }
+ }
default:
rb_bug("rb_method_entry_arity: invalid method entry type (%d)", me->type);
}
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index dc44eee274..c60f7fa8a8 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -51,6 +51,10 @@ class TestMethod < Test::Unit::TestCase
assert_equal(-3, method(:mo6).arity)
end
+ def test_arity_special
+ assert_equal(-1, method(:__send__).arity)
+ end
+
def test_unbind
assert_equal(:derived, Derived.new.foo)
um = Derived.new.method(:foo).unbind