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

ruby-changes:30855

From: nagachika <ko1@a...>
Date: Fri, 13 Sep 2013 23:01:13 +0900 (JST)
Subject: [ruby-changes:30855] nagachika:r42934 (ruby_2_0_0): merge revision(s) 42782, 42799: [Backport #8902]

nagachika	2013-09-13 23:01:07 +0900 (Fri, 13 Sep 2013)

  New Revision: 42934

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

  Log:
    merge revision(s) 42782,42799: [Backport #8902]
    
    * vm_insnhelper.c (vm_search_super_method): use ci->argc instead of
      ci->orig_argc. ci->argc can be changed by splat arguments.
      [ruby-list:49575]
      This fix should be applied to Ruby 2.0.0 seriese.
    
    * test/ruby/test_super.rb: add a test for above.
    
    * numeric.c (NUM_STEP_SCAN_ARGS): On second thought, keep
    
    * internal.h (bit_length): Add casts to fix compilation error with
      This fix should be applied to Ruby 2.0.0 series.
      numeric literal, for the backward compatibility.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/test/ruby/test_super.rb
    branches/ruby_2_0_0/version.h
    branches/ruby_2_0_0/vm_insnhelper.c
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 42933)
+++ ruby_2_0_0/ChangeLog	(revision 42934)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Sep 13 22:40:28 2013  Koichi Sasada  <ko1@a...>
+
+	* vm_insnhelper.c (vm_search_super_method): use ci->argc instead of
+	  ci->orig_argc. ci->argc can be changed by splat arguments.
+	  [ruby-list:49575]
+	  This fix should be applied to Ruby 2.0.0 series.
+
+	* test/ruby/test_super.rb: add a test for above.
+
 Fri Sep 13 01:44:54 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* thread.c (rb_mutex_unlock): Mutex#unlock no longer raise
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 42933)
+++ ruby_2_0_0/version.h	(revision 42934)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-09-13"
-#define RUBY_PATCHLEVEL 309
+#define RUBY_PATCHLEVEL 310
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_0_0/vm_insnhelper.c
===================================================================
--- ruby_2_0_0/vm_insnhelper.c	(revision 42933)
+++ ruby_2_0_0/vm_insnhelper.c	(revision 42934)
@@ -1991,7 +1991,7 @@ vm_search_super_method(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/vm_insnhelper.c#L1991
 {
     VALUE current_defined_class;
     rb_iseq_t *iseq = GET_ISEQ();
-    VALUE sigval = TOPN(ci->orig_argc);
+    VALUE sigval = TOPN(ci->argc);
 
     current_defined_class = GET_CFP()->klass;
     if (NIL_P(current_defined_class)) {
Index: ruby_2_0_0/test/ruby/test_super.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_super.rb	(revision 42933)
+++ ruby_2_0_0/test/ruby/test_super.rb	(revision 42934)
@@ -385,4 +385,27 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_super.rb#L385
   def test_super_in_BEGIN
     assert_super_in_block("BEGIN")
   end
+
+  class X
+    def foo(*args)
+      args
+    end
+  end
+
+  class Y < X
+    define_method(:foo) do |*args|
+      super(*args)
+    end
+  end
+
+  def test_super_splat
+    # [ruby-list:49575] 
+    y = Y.new
+    assert_equal([1, 2], y.foo(1, 2))
+    assert_equal([1, false], y.foo(1, false))
+    assert_equal([1, 2, 3, 4, 5], y.foo(1, 2, 3, 4, 5))
+    assert_equal([false, true], y.foo(false, true))
+    assert_equal([false, false], y.foo(false, false))
+    assert_equal([1, 2, 3, false, 5], y.foo(1, 2, 3, false, 5))
+  end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r42782,42799


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

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