1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* expand tabs.

This commit is contained in:
git 2019-07-31 10:22:47 +09:00
parent 72825c35b0
commit e315f3a134
3 changed files with 6 additions and 6 deletions

View file

@ -273,7 +273,7 @@ dump_object(VALUE obj, struct dump_config *dc)
case T_HASH: case T_HASH:
dump_append(dc, ", \"size\":%"PRIuSIZE, (size_t)RHASH_SIZE(obj)); dump_append(dc, ", \"size\":%"PRIuSIZE, (size_t)RHASH_SIZE(obj));
if (FL_TEST(obj, RHASH_PROC_DEFAULT)) if (FL_TEST(obj, RHASH_PROC_DEFAULT))
dump_append(dc, ", \"default\":\"%#"PRIxVALUE"\"", RHASH_IFNONE(obj)); dump_append(dc, ", \"default\":\"%#"PRIxVALUE"\"", RHASH_IFNONE(obj));
break; break;

8
hash.c
View file

@ -1505,7 +1505,7 @@ rb_hash_dup(VALUE hash)
{ {
const VALUE flags = RBASIC(hash)->flags; const VALUE flags = RBASIC(hash)->flags;
VALUE ret = hash_dup(hash, rb_obj_class(hash), VALUE ret = hash_dup(hash, rb_obj_class(hash),
flags & (FL_EXIVAR|FL_TAINT|RHASH_PROC_DEFAULT)); flags & (FL_EXIVAR|FL_TAINT|RHASH_PROC_DEFAULT));
if (flags & FL_EXIVAR) if (flags & FL_EXIVAR)
rb_copy_generic_ivar(ret, hash); rb_copy_generic_ivar(ret, hash);
return ret; return ret;
@ -1885,7 +1885,7 @@ rb_hash_default_value(VALUE hash, VALUE key)
{ {
if (rb_method_basic_definition_p(CLASS_OF(hash), id_default)) { if (rb_method_basic_definition_p(CLASS_OF(hash), id_default)) {
VALUE ifnone = RHASH_IFNONE(hash); VALUE ifnone = RHASH_IFNONE(hash);
if (!FL_TEST(hash, RHASH_PROC_DEFAULT)) return ifnone; if (!FL_TEST(hash, RHASH_PROC_DEFAULT)) return ifnone;
if (key == Qundef) return Qnil; if (key == Qundef) return Qnil;
return rb_funcall(ifnone, id_yield, 2, hash, key); return rb_funcall(ifnone, id_yield, 2, hash, key);
} }
@ -3302,7 +3302,7 @@ rb_hash_to_h(VALUE hash)
} }
if (rb_obj_class(hash) != rb_cHash) { if (rb_obj_class(hash) != rb_cHash) {
const VALUE flags = RBASIC(hash)->flags; const VALUE flags = RBASIC(hash)->flags;
hash = hash_dup(hash, rb_cHash, flags & RHASH_PROC_DEFAULT); hash = hash_dup(hash, rb_cHash, flags & RHASH_PROC_DEFAULT);
} }
return hash; return hash;
} }
@ -3546,7 +3546,7 @@ hash_equal(VALUE hash1, VALUE hash2, int eql)
#if 0 #if 0
if (!(rb_equal(RHASH_IFNONE(hash1), RHASH_IFNONE(hash2)) && if (!(rb_equal(RHASH_IFNONE(hash1), RHASH_IFNONE(hash2)) &&
FL_TEST(hash1, RHASH_PROC_DEFAULT) == FL_TEST(hash2, RHASH_PROC_DEFAULT))) FL_TEST(hash1, RHASH_PROC_DEFAULT) == FL_TEST(hash2, RHASH_PROC_DEFAULT)))
return Qfalse; return Qfalse;
#endif #endif
return Qtrue; return Qtrue;

View file

@ -917,7 +917,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
if (NIL_P(RHASH_IFNONE(obj))) { if (NIL_P(RHASH_IFNONE(obj))) {
w_byte(TYPE_HASH, arg); w_byte(TYPE_HASH, arg);
} }
else if (FL_TEST(obj, RHASH_PROC_DEFAULT)) { else if (FL_TEST(obj, RHASH_PROC_DEFAULT)) {
rb_raise(rb_eTypeError, "can't dump hash with default proc"); rb_raise(rb_eTypeError, "can't dump hash with default proc");
} }
else { else {