summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-13 18:01:59 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-13 18:01:59 (GMT)
commitb73e900f50e74504c48f05811dbfb2aabdf40cdc (patch)
treeeb307802dff370bdef006b8faf49b64be2820d80 /vm.c
parent25f5dd6799bbacc9f61d60b87b70ea6e6d815c20 (diff)
* vm.c (vm_define_method): refactoring.
* get CREF in this function. * cbase is no longer needed (CREF_CLASS(cref) is enough). * compile.c: RubyVM::FrozenCore.define_method only accept 2 args. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/vm.c b/vm.c
index a2e3938..81de1a2 100644
--- a/vm.c
+++ b/vm.c
@@ -2337,14 +2337,14 @@ rb_thread_alloc(VALUE klass)
}
static void
-vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
- rb_num_t is_singleton, rb_cref_t *cref)
+vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval, int is_singleton)
{
VALUE klass;
rb_method_visibility_t visi;
+ rb_cref_t *cref = rb_vm_cref();
if (!is_singleton) {
- klass = obj;
+ klass = CREF_CLASS(cref);
visi = rb_scope_visibility_get();
}
else { /* singleton */
@@ -2374,10 +2374,10 @@ vm_define_method(rb_thread_t *th, VALUE obj, ID id, VALUE iseqval,
} while (0)
static VALUE
-m_core_define_method(VALUE self, VALUE cbase, VALUE sym, VALUE iseqval)
+m_core_define_method(VALUE self, VALUE sym, VALUE iseqval)
{
REWIND_CFP({
- vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 0, rb_vm_cref());
+ vm_define_method(GET_THREAD(), Qnil, SYM2ID(sym), iseqval, FALSE);
});
return sym;
}
@@ -2386,7 +2386,7 @@ static VALUE
m_core_define_singleton_method(VALUE self, VALUE cbase, VALUE sym, VALUE iseqval)
{
REWIND_CFP({
- vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, 1, rb_vm_cref());
+ vm_define_method(GET_THREAD(), cbase, SYM2ID(sym), iseqval, TRUE);
});
return sym;
}
@@ -2586,7 +2586,7 @@ Init_VM(void)
rb_define_method_id(klass, id_core_set_method_alias, m_core_set_method_alias, 3);
rb_define_method_id(klass, id_core_set_variable_alias, m_core_set_variable_alias, 2);
rb_define_method_id(klass, id_core_undef_method, m_core_undef_method, 2);
- rb_define_method_id(klass, id_core_define_method, m_core_define_method, 3);
+ rb_define_method_id(klass, id_core_define_method, m_core_define_method, 2);
rb_define_method_id(klass, id_core_define_singleton_method, m_core_define_singleton_method, 3);
rb_define_method_id(klass, id_core_set_postexe, m_core_set_postexe, 0);
rb_define_method_id(klass, id_core_hash_from_ary, m_core_hash_from_ary, 1);