diff options
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index a886685be6..0fe9902418 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1061,46 +1061,6 @@ vm_get_cvar_base(NODE *cref) return klass; } -static inline void -vm_define_method(rb_thread_t *th, VALUE obj, ID id, rb_iseq_t *miseq, - rb_num_t is_singleton, NODE *cref) -{ - NODE *newbody; - VALUE klass = cref->nd_clss; - int noex = cref->nd_visi; - - if (NIL_P(klass)) { - rb_raise(rb_eTypeError, "no class/module to add method"); - } - - if (is_singleton) { - if (FIXNUM_P(obj) || SYMBOL_P(obj)) { - rb_raise(rb_eTypeError, - "can't define singleton method \"%s\" for %s", - rb_id2name(id), rb_obj_classname(obj)); - } - - if (OBJ_FROZEN(obj)) { - rb_error_frozen("object"); - } - - klass = rb_singleton_class(obj); - noex = NOEX_PUBLIC; - } - - /* dup */ - COPY_CREF(miseq->cref_stack, cref); - miseq->klass = klass; - miseq->defined_method_id = id; - newbody = NEW_NODE(RUBY_VM_METHOD_NODE, 0, miseq->self, 0); - rb_add_method(klass, id, newbody, noex); - - if (!is_singleton && noex == NOEX_MODFUNC) { - rb_add_method(rb_singleton_class(klass), id, newbody, NOEX_PUBLIC); - } - INC_VM_STATE_VERSION(); -} - static inline NODE * vm_method_search(VALUE id, VALUE klass, IC ic) { |