From 1fc33199736f316dd71d0c551edbf514528ddde6 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 24 Dec 2013 07:28:11 +0000 Subject: proc.c: make method by define_method public * proc.c (rb_mod_define_method): consider visibility only if self in the caller is same as the receiver, otherwise make public as well as old behavior. [ruby-core:57747] [Bug #9005] [ruby-core:58497] [Bug #9141] * vm.c (rb_vm_cref_in_context): return ruby level cref if self is same. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vm.c') diff --git a/vm.c b/vm.c index e1c629867b..947b1811e5 100644 --- a/vm.c +++ b/vm.c @@ -930,6 +930,15 @@ rb_vm_cref(void) return rb_vm_get_cref(cfp->iseq, cfp->ep); } +NODE * +rb_vm_cref_in_context(VALUE self) +{ + rb_thread_t *th = GET_THREAD(); + const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp); + if (cfp->self != self) return NULL; + return rb_vm_get_cref(cfp->iseq, cfp->ep); +} + #if 0 void debug_cref(NODE *cref) -- cgit v1.2.3