зеркало из https://github.com/github/ruby.git
hash.c: reword
* hash.c (HAS_EXTRA_STATES, rb_hash_reject): use words "extra states". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
16863d903b
Коммит
21e74f5481
19
hash.c
19
hash.c
|
@ -27,12 +27,12 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#define HAS_MISC_ATTRIBUTES(hash, klass) ( \
|
||||
#define HAS_EXTRA_STATES(hash, klass) ( \
|
||||
(klass = rb_obj_class(hash)) != rb_cHash || \
|
||||
(klass = 0, \
|
||||
FL_TEST((hash), FL_EXIVAR|FL_TAINT|HASH_PROC_DEFAULT) || \
|
||||
FL_TEST((hash), FL_EXIVAR|FL_TAINT|HASH_PROC_DEFAULT) || \
|
||||
!NIL_P(RHASH_IFNONE(hash))))
|
||||
#define HASH_REJECT_COPY_MISC_ATTRIBUTES 1
|
||||
#define HASH_REJECT_COPY_EXTRA_STATES 1
|
||||
|
||||
static VALUE rb_hash_s_try_convert(VALUE, VALUE);
|
||||
|
||||
|
@ -1133,11 +1133,11 @@ rb_hash_reject(VALUE hash)
|
|||
RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
|
||||
if (RTEST(ruby_verbose)) {
|
||||
VALUE klass;
|
||||
if (HAS_MISC_ATTRIBUTES(hash, klass)) {
|
||||
#if HASH_REJECT_COPY_MISC_ATTRIBUTES
|
||||
rb_warn("copying unguaranteed attributes: %+"PRIsVALUE, hash);
|
||||
rb_warn("following atributes will not be copied in the future version:");
|
||||
if (klass != rb_cHash) {
|
||||
if (HAS_EXTRA_STATES(hash, klass)) {
|
||||
#if HASH_REJECT_COPY_EXTRA_STATES
|
||||
rb_warn("copying extra states: %+"PRIsVALUE, hash);
|
||||
rb_warn("following states will not be copied in the future version:");
|
||||
if (klass) {
|
||||
rb_warn(" subclass: %+"PRIsVALUE, klass);
|
||||
}
|
||||
if (FL_TEST(hash, FL_EXIVAR)) {
|
||||
|
@ -1153,8 +1153,7 @@ rb_hash_reject(VALUE hash)
|
|||
else if (!NIL_P(RHASH_IFNONE(hash)))
|
||||
rb_warn(" default value: %+"PRIsVALUE, RHASH_IFNONE(hash));
|
||||
#else
|
||||
rb_warn("unguaranteed attributes are not copied: %+"PRIsVALUE, hash);
|
||||
rb_warn("following atributes are ignored now:");
|
||||
rb_warn("extra states are no longer copied: %+"PRIsVALUE, hash);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче