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

ruby-changes:32747

From: naruse <ko1@a...>
Date: Wed, 5 Feb 2014 13:05:59 +0900 (JST)
Subject: [ruby-changes:32747] naruse:r44826 (ruby_2_1): merge revision(s) 44501: [Backport #9353]

naruse	2014-02-05 13:05:53 +0900 (Wed, 05 Feb 2014)

  New Revision: 44826

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

  Log:
    merge revision(s) 44501: [Backport #9353]
    
    * struct.c (rb_struct_set): return assigned value from setter method
      rather than struct object. [Bug #9353] [ruby-core:59509]
    
    * test/ruby/test_struct.rb (test_setter_method_returns_value): add test

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/struct.c
    branches/ruby_2_1/test/ruby/test_struct.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 44825)
+++ ruby_2_1/ChangeLog	(revision 44826)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Wed Feb  5 11:48:42 2014  Charlie Somerville  <charliesome@r...>
+
+	* struct.c (rb_struct_set): return assigned value from setter method
+	  rather than struct object. [Bug #9353] [ruby-core:59509]
+
+	* test/ruby/test_struct.rb (test_setter_method_returns_value): add test
+
 Wed Feb  5 11:13:21 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* string.c (rb_str_modify_expand): enable capacity and disable
Index: ruby_2_1/struct.c
===================================================================
--- ruby_2_1/struct.c	(revision 44825)
+++ ruby_2_1/struct.c	(revision 44826)
@@ -156,7 +156,8 @@ rb_struct_set(VALUE obj, VALUE val) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/struct.c#L156
     for (i=0; i<len; i++) {
 	slot = RARRAY_AREF(members, i);
 	if (rb_id_attrset(SYM2ID(slot)) == rb_frame_this_func()) {
-	    return RSTRUCT_SET(obj, i, val);
+	    RSTRUCT_SET(obj, i, val);
+	    return val;
 	}
     }
     rb_name_error(rb_frame_this_func(), "`%s' is not a struct member",
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 44825)
+++ ruby_2_1/version.h	(revision 44826)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.1"
 #define RUBY_RELEASE_DATE "2014-02-05"
-#define RUBY_PATCHLEVEL 16
+#define RUBY_PATCHLEVEL 17
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 2
Index: ruby_2_1/test/ruby/test_struct.rb
===================================================================
--- ruby_2_1/test/ruby/test_struct.rb	(revision 44825)
+++ ruby_2_1/test/ruby/test_struct.rb	(revision 44826)
@@ -298,6 +298,12 @@ module TestStruct https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_struct.rb#L298
     assert_same(x, o.b!)
   end
 
+  def test_setter_method_returns_value
+    klass = @Struct.new(:a)
+    x = klass.new
+    assert_equal "[Bug #9353]", x.send(:a=, "[Bug #9353]")
+  end
+
   class TopStruct < Test::Unit::TestCase
     include TestStruct
 

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44501


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

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