summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-05 04:05:53 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-05 04:05:53 +0000
commitbda2300c4d50a73bcda66f886c362e7f4da82da5 (patch)
treeabedac3349bbccb85021efb535b9e758833999ad /struct.c
parent673745f7999bdb5b8c0909f00b7d0fa14a0af43c (diff)
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@44826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/struct.c b/struct.c
index 6be512eaee..2e026fbc7f 100644
--- a/struct.c
+++ b/struct.c
@@ -156,7 +156,8 @@ rb_struct_set(VALUE obj, VALUE val)
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",