[前][次][番号順一覧][スレッド一覧]

ruby-changes:12595

From: ko1 <ko1@a...>
Date: Tue, 28 Jul 2009 19:41:36 +0900 (JST)
Subject: [ruby-changes:12595] Ruby:r24306 (trunk): * proc.c (rb_method_entry_arity): support optimized method (send).

ko1	2009-07-28 19:41:11 +0900 (Tue, 28 Jul 2009)

  New Revision: 24306

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24306

  Log:
    * proc.c (rb_method_entry_arity): support optimized method (send).
    * test/ruby/test_method.rb: add a test for above.

  Modified files:
    trunk/ChangeLog
    trunk/proc.c
    trunk/test/ruby/test_method.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24305)
+++ ChangeLog	(revision 24306)
@@ -1,3 +1,9 @@
+Tue Jul 28 19:36:26 2009  Koichi Sasada  <ko1@a...>
+
+	* 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@a...>
 
 	* ext/tk/lib/extconf.rb: bug fix and ignore invalid Tcl/Tk libraries.
Index: proc.c
===================================================================
--- proc.c	(revision 24305)
+++ proc.c	(revision 24306)
@@ -1487,6 +1487,14 @@
 	      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);
     }
Index: test/ruby/test_method.rb
===================================================================
--- test/ruby/test_method.rb	(revision 24305)
+++ test/ruby/test_method.rb	(revision 24306)
@@ -51,6 +51,10 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]