@@ -1858,11 +1858,18 @@ mrb_hash_to_s(mrb_state *mrb, mrb_value self)
|
1858 | 1858 | struct RHash *h = mrb_hash_ptr(self); |
1859 | 1859 | H_EACH(h, entry) { |
1860 | 1860 | if (i++ > 0) mrb_str_cat_lit(mrb, ret, ", "); |
1861 | | -H_CHECK_MODIFIED(mrb, h) { |
1862 | | -mrb_str_cat_str(mrb, ret, mrb_inspect(mrb, entry->key)); |
| 1861 | +if (mrb_symbol_p(entry->key)) { |
| 1862 | +mrb_str_cat_str(mrb, ret, mrb_obj_as_string(mrb, entry->key)); |
| 1863 | +mrb_gc_arena_restore(mrb, ai); |
| 1864 | +mrb_str_cat_lit(mrb, ret, ": "); |
| 1865 | + } |
| 1866 | +else { |
| 1867 | +H_CHECK_MODIFIED(mrb, h) { |
| 1868 | +mrb_str_cat_str(mrb, ret, mrb_inspect(mrb, entry->key)); |
| 1869 | + } |
| 1870 | +mrb_gc_arena_restore(mrb, ai); |
| 1871 | +mrb_str_cat_lit(mrb, ret, " => "); |
1863 | 1872 | } |
1864 | | -mrb_gc_arena_restore(mrb, ai); |
1865 | | -mrb_str_cat_lit(mrb, ret, " => "); |
1866 | 1873 | H_CHECK_MODIFIED(mrb, h) { |
1867 | 1874 | mrb_str_cat_str(mrb, ret, mrb_inspect(mrb, entry->val)); |
1868 | 1875 | } |
|