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

ruby-changes:45269

From: nagachika <ko1@a...>
Date: Tue, 17 Jan 2017 03:59:45 +0900 (JST)
Subject: [ruby-changes:45269] nagachika:r57342 (ruby_2_3): merge revision(s) 56469: [Backport #12860]

nagachika	2017-01-17 03:59:40 +0900 (Tue, 17 Jan 2017)

  New Revision: 57342

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57342

  Log:
    merge revision(s) 56469: [Backport #12860]
    
    * compile.c (setup_args): duplicate splatting array if more
      arguments present to obey left-to-right execution order.
      [ruby-core:77701] [Bug# 12860]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/compile.c
    branches/ruby_2_3/test/ruby/test_call.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/compile.c
===================================================================
--- ruby_2_3/compile.c	(revision 57341)
+++ ruby_2_3/compile.c	(revision 57342)
@@ -3615,7 +3615,7 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR https://github.com/ruby/ruby/blob/trunk/ruby_2_3/compile.c#L3615
 	switch (nd_type(argn)) {
 	  case NODE_SPLAT: {
 	    COMPILE(args, "args (splat)", argn->nd_head);
-	    ADD_INSN1(args, nd_line(argn), splatarray, Qfalse);
+	    ADD_INSN1(args, nd_line(argn), splatarray, nsplat ? Qtrue : Qfalse);
 	    argc = INT2FIX(1);
 	    nsplat++;
 	    *flag |= VM_CALL_ARGS_SPLAT;
@@ -3629,7 +3629,7 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR https://github.com/ruby/ruby/blob/trunk/ruby_2_3/compile.c#L3629
 	    INIT_ANCHOR(tmp);
 	    COMPILE(tmp, "args (cat: splat)", argn->nd_body);
 	    if (nd_type(argn) == NODE_ARGSCAT) {
-		ADD_INSN1(tmp, nd_line(argn), splatarray, Qfalse);
+		ADD_INSN1(tmp, nd_line(argn), splatarray, nsplat ? Qtrue : Qfalse);
 	    }
 	    else {
 		ADD_INSN1(tmp, nd_line(argn), newarray, INT2FIX(1));
Index: ruby_2_3/test/ruby/test_call.rb
===================================================================
--- ruby_2_3/test/ruby/test_call.rb	(revision 57341)
+++ ruby_2_3/test/ruby/test_call.rb	(revision 57342)
@@ -90,4 +90,12 @@ class TestCall < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_call.rb#L90
       h[:foo] = nil
     }
   end
+
+  def test_call_splat_order
+    bug12860 = '[ruby-core:77701] [Bug# 12860]'
+    ary = [1, 2]
+    assert_equal([1, 2, 1], aaa(*ary, ary.shift), bug12860)
+    ary = [1, 2]
+    assert_equal([0, 1, 2, 1], aaa(0, *ary, ary.shift), bug12860)
+  end
 end
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 57341)
+++ ruby_2_3/version.h	(revision 57342)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.3"
 #define RUBY_RELEASE_DATE "2017-01-17"
-#define RUBY_PATCHLEVEL 226
+#define RUBY_PATCHLEVEL 227
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 57341)
+++ ruby_2_3/ChangeLog	(revision 57342)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Tue Jan 17 03:51:48 2017  Nobuyoshi Nakada  <nobu@r...>
+
+	* compile.c (setup_args): duplicate splatting array if more
+	  arguments present to obey left-to-right execution order.
+	  [ruby-core:77701] [Bug# 12860]
+
 Thu Nov 24 05:47:18 2016  CHIKANAGA Tomoyuki  <nagachika@r...>
 
 	* test/fileutils/test_fileutils.rb (TestFileUtils#setup): Use primary

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r56469


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

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