int is_singleton) { VALUE klass; rb_method_visibility_t visi; rb_cref_t *cref = rb_vm_cref(); if (!is_singleton) { klass = CREF_CLASS(cref); visi = rb_scope_visibility_get(); } else { /* singleton */ klass = rb_singleton_class(obj); /* class and frozen checked in this API */ visi = METHOD_VISI_PUBLIC; } if (NIL_P(klass)) { rb_raise(rb_eTypeError, "no class/module to add method"); } rb_add_method_iseq(klass, id, (const rb_iseq_t *)iseqval, cref, visi); if (!is_singleton && rb_scope_module_func_check()) { klass = rb_singleton_class(klass);