diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-09-01 18:45:03 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-09-01 19:28:54 +0900 |
commit | 10ebf87428fa41dcbb179f8a35428fb63dc69d5c (patch) | |
tree | cf86f5d3ed2fbc0d4991bca6091b9ef0721a8fa2 | |
parent | f9bdb17c02ff012b6b9bb46463a3596b6f99f144 (diff) | |
download | ruby-10ebf87428fa41dcbb179f8a35428fb63dc69d5c.tar.gz |
Assert not to be UNDEF visibility
Any defined methods, bound to any classes/modules and not being
UNDEFINED_METHOD_ENTRY_P, should not be METHOD_VISI_UNDEF.
-rw-r--r-- | class.c | 1 | ||||
-rw-r--r-- | proc.c | 1 |
2 files changed, 2 insertions, 0 deletions
@@ -1435,6 +1435,7 @@ method_entry_i(ID key, VALUE value, void *data) } else { type = METHOD_ENTRY_VISI(me); + RUBY_ASSERT(type != METHOD_VISI_UNDEF); } st_add_direct(arg->list, key, (st_data_t)type); } @@ -1657,6 +1657,7 @@ mnew_internal(const rb_method_entry_t *me, VALUE klass, VALUE iclass, } if (visi == METHOD_VISI_UNDEF) { visi = METHOD_ENTRY_VISI(me); + RUBY_ASSERT(visi != METHOD_VISI_UNDEF); /* !UNDEFINED_METHOD_ENTRY_P(me) */ if (scope && (visi != METHOD_VISI_PUBLIC)) { if (!error) return Qnil; rb_print_inaccessible(klass, id, visi); |