summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-07 18:40:10 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-07 18:40:10 +0900
commitfe1b4cea417847802de9be0bcde216752cd2e063 (patch)
tree4250a952137054459ccf8673b3dc32605efdcfd6 /src
parent23853acbb67ef09dfded6c4a31f16d03c5260554 (diff)
downloadmruby-fe1b4cea417847802de9be0bcde216752cd2e063.tar.gz
mruby-fe1b4cea417847802de9be0bcde216752cd2e063.zip
Hash#== and eql? should not return fixnum; ref #1823
Diffstat (limited to 'src')
-rw-r--r--src/hash.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/hash.c b/src/hash.c
index 1091ca643..af3571eaf 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -880,10 +880,17 @@ hash_equal(mrb_state *mrb, mrb_value hash1, mrb_value hash2, mrb_bool eql)
if (!mrb_respond_to(mrb, hash2, mrb_intern_lit(mrb, "to_hash"))) {
return mrb_false_value();
}
- if (eql)
- return mrb_fixnum_value(mrb_eql(mrb, hash2, hash1));
- else
- return mrb_fixnum_value(mrb_equal(mrb, hash2, hash1));
+ else {
+ mrb_bool eq;
+
+ if (eql) {
+ eq = mrb_eql(mrb, hash2, hash1);
+ }
+ else {
+ eq = mrb_equal(mrb, hash2, hash1);
+ }
+ return mrb_bool_value(eq);
+ }
}
h1 = RHASH_TBL(hash1);
h2 = RHASH_TBL(hash2);