summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 947b181..bd0d656 100644
--- a/vm.c
+++ b/vm.c
@@ -930,13 +930,16 @@ rb_vm_cref(void)
return rb_vm_get_cref(cfp->iseq, cfp->ep);
}
-NODE *
-rb_vm_cref_in_context(VALUE self)
+const NODE *
+rb_vm_cref_in_context(VALUE self, VALUE cbase)
{
rb_thread_t *th = GET_THREAD();
const rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp);
+ const NODE *cref;
if (cfp->self != self) return NULL;
- return rb_vm_get_cref(cfp->iseq, cfp->ep);
+ cref = rb_vm_get_cref(cfp->iseq, cfp->ep);
+ if (cref->nd_clss != cbase) return NULL;
+ return cref;
}
#if 0