3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'ext/callsite.c', line 3
VALUE
callsite_caller_class(VALUE self)
{
rb_control_frame_t *cfp = ruby_current_thread->cfp;
/* pop 2 stack frames */
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
/* pop any block stack frames */
while (!cfp->iseq) cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
if (cfp->iseq != 0 && cfp->pc != 0) {
return cfp->iseq->klass;
}
return Qnil;
struct FRAME *frame = ruby_frame->prev->prev;
if (frame->flags == 1) frame = frame->prev;
return frame->last_class;
}
|