summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authorcharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-04 13:44:34 +0000
committercharliesome <charliesome@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-04 13:44:34 +0000
commit306c154c2d0010cebd600175f3f70083fc787599 (patch)
tree8dce16352c3689266473d690c159322a60f8c366 /struct.c
parent54f6b3fe826f49ad245db65f692cfc6096706bd3 (diff)
* 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/trunk@44501 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",