ruby-changes:24177
From: naruse <ko1@a...>
Date: Wed, 27 Jun 2012 08:32:26 +0900 (JST)
Subject: [ruby-changes:24177] naruse:r36228 (ruby_1_9_3): merge revision(s) 34633: [Backport #5124]
naruse 2012-06-27 08:32:12 +0900 (Wed, 27 Jun 2012) New Revision: 36228 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36228 Log: merge revision(s) 34633: [Backport #5124] * insns.def (splatarray): make new array if flag is set. * compile.c (iseq_compile_each): make new array with splat. [ruby-core:21901][Feature #1125] Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/compile.c branches/ruby_1_9_3/insns.def branches/ruby_1_9_3/test/ruby/test_basicinstructions.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 36227) +++ ruby_1_9_3/ChangeLog (revision 36228) @@ -1,3 +1,10 @@ +Wed Jun 27 08:31:50 2012 Nobuyoshi Nakada <nobu@r...> + + * insns.def (splatarray): make new array if flag is set. + + * compile.c (iseq_compile_each): make new array with + splat. [ruby-core:21901][Feature #1125] + Wed Jun 27 04:23:26 2012 Nobuyoshi Nakada <nobu@r...> * win32/win32.c (rb_w32_sysinit): let the system not display the Index: ruby_1_9_3/insns.def =================================================================== --- ruby_1_9_3/insns.def (revision 36227) +++ ruby_1_9_3/insns.def (revision 36228) @@ -533,6 +533,9 @@ if (NIL_P(tmp)) { tmp = rb_ary_new3(1, ary); } + else if (RTEST(flag)) { + tmp = rb_ary_dup(tmp); + } obj = tmp; } Index: ruby_1_9_3/compile.c =================================================================== --- ruby_1_9_3/compile.c (revision 36227) +++ ruby_1_9_3/compile.c (revision 36228) @@ -4629,7 +4629,7 @@ } case NODE_SPLAT:{ COMPILE(ret, "splat", node->nd_head); - ADD_INSN1(ret, nd_line(node), splatarray, Qfalse); + ADD_INSN1(ret, nd_line(node), splatarray, Qtrue); if (poped) { ADD_INSN(ret, nd_line(node), pop); Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 36227) +++ ruby_1_9_3/version.h (revision 36228) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 241 +#define RUBY_PATCHLEVEL 242 #define RUBY_RELEASE_DATE "2012-06-27" #define RUBY_RELEASE_YEAR 2012 Index: ruby_1_9_3/test/ruby/test_basicinstructions.rb =================================================================== --- ruby_1_9_3/test/ruby/test_basicinstructions.rb (revision 36227) +++ ruby_1_9_3/test/ruby/test_basicinstructions.rb (revision 36228) @@ -632,7 +632,7 @@ assert_equal 'i', $~[9] assert_equal 'x', $` assert_equal 'abcdefghi', $& - assert_equal 'y', $' + assert_equal "y", $' assert_equal 'i', $+ assert_equal 'a', $1 assert_equal 'b', $2 @@ -662,15 +662,20 @@ end def test_array_splat + feature1125 = '[ruby-core:21901]' + a = [] assert_equal [], [*a] assert_equal [1], [1, *a] + assert_not_same(a, [*a], feature1125) a = [2] assert_equal [2], [*a] assert_equal [1, 2], [1, *a] + assert_not_same(a, [*a], feature1125) a = [2, 3] assert_equal [2, 3], [*a] assert_equal [1, 2, 3], [1, *a] + assert_not_same(a, [*a], feature1125) a = nil assert_equal [], [*a] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/