Hash#delete should return the deleted value; fix #4133

This commit is contained in:
Yukihiro "Matz" Matsumoto
2018-10-12 08:25:54 +09:00
parent a690aef8d3
commit 82e00ce60f
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -460,7 +460,7 @@ sg_del(mrb_state *mrb, seglist *t, mrb_value key, mrb_value *vp)
}
key2 = seg->e[i].key;
if (!mrb_undef_p(key2) && sg_hash_equal(mrb, t, key, key2)) {
if (vp) *vp = key2;
if (vp) *vp = seg->e[i].val;
seg->e[i].key = mrb_undef_value();
t->size--;
return TRUE;