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

ruby-changes:28327

From: nagachika <ko1@a...>
Date: Sat, 20 Apr 2013 01:02:21 +0900 (JST)
Subject: [ruby-changes:28327] nagachika:r40379 (ruby_2_0_0): merge revision(s) 40205: [Backport #8236]

nagachika	2013-04-20 01:02:09 +0900 (Sat, 20 Apr 2013)

  New Revision: 40379

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

  Log:
    merge revision(s) 40205: [Backport #8236]
    
    * compile.c (iseq_compile_each): append keyword hash to argument array
      to splat if needed.  [ruby-core:54094] [Bug #8236]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/compile.c
    branches/ruby_2_0_0/test/ruby/test_keyword.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 40378)
+++ ruby_2_0_0/ChangeLog	(revision 40379)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Apr 20 00:41:10 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* compile.c (iseq_compile_each): append keyword hash to argument array
+	  to splat if needed.  [ruby-core:54094] [Bug #8236]
+
 Sat Apr 20 00:31:57 2013  Kouhei Sutou  <kou@c...>
 
 	* README.EXT.ja (Data_Wrap_Struct): Remove a description about
Index: ruby_2_0_0/compile.c
===================================================================
--- ruby_2_0_0/compile.c	(revision 40378)
+++ ruby_2_0_0/compile.c	(revision 40379)
@@ -4485,6 +4485,11 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/compile.c#L4485
 			ADD_INSN2(args, line, getlocal, INT2FIX(idx), INT2FIX(lvar_level));
 		    }
 		    ADD_SEND(args, line, ID2SYM(id_core_hash_merge_ptr), INT2FIX(i * 2 + 1));
+		    if (liseq->arg_rest != -1) {
+			ADD_INSN1(args, line, newarray, INT2FIX(1));
+			ADD_INSN (args, line, concatarray);
+			--argc;
+		    }
 		}
 	    }
 	}
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 40378)
+++ ruby_2_0_0/version.h	(revision 40379)
@@ -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-04-20"
-#define RUBY_PATCHLEVEL 146
+#define RUBY_PATCHLEVEL 147
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 4
Index: ruby_2_0_0/test/ruby/test_keyword.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_keyword.rb	(revision 40378)
+++ ruby_2_0_0/test/ruby/test_keyword.rb	(revision 40379)
@@ -290,4 +290,25 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_keyword.rb#L290
     assert_equal(1, o.bug7942(), bug7942)
     assert_equal(42, o.bug7942(a: 42), bug7942)
   end
+
+  def test_super_with_keyword
+    bug8236 = '[ruby-core:54094] [Bug #8236]'
+    base = Class.new do
+      def foo(*args)
+        args
+      end
+    end
+    a = Class.new(base) do
+      def foo(arg, bar: 'x')
+        super
+      end
+    end
+    b = Class.new(base) do
+      def foo(*args, bar: 'x')
+        super
+      end
+    end
+    assert_equal([42, {:bar=>"x"}], a.new.foo(42), bug8236)
+    assert_equal([42, {:bar=>"x"}], b.new.foo(42), bug8236)
+  end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r40205


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

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