-
In cruby there is the gem binding_of_caller which can provide the calling object for different levels of the calling stack
Can I get this info also for mruby ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
There is no way to get it from Ruby side.
From C side, you can get |
Beta Was this translation helpful? Give feedback.
-
Can this discussion be kept open/stored somewhere in order that others can benefit out of this ? |
Beta Was this translation helpful? Give feedback.
I can think of two things.
-g
switch is not specified.mrb_proc_get_caller()
andmrb_binding_new()
used bymrb_binding_of_caller()
do not support any level of caller.They must be extended to accept
ci
arguments.And, there was a mistake in #6072 (comment).
Since the current ci needs to be removed, the range is
0 <= caller_level < (mrb->c->ci - mrb->c->cibase)
and is obtained asmrb->c->ci[-1 - caller_level]
.