Skip to content

Get receiver object for different levels of calling stack #6072

Answered by dearblue
lemmuh asked this question in Q&A
Discussion options

You must be logged in to vote

I can think of two things.

  • If you are using the mrbc command, the required -g switch is not specified.
  • The mrb_proc_get_caller() and mrb_binding_new() used by mrb_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 as mrb->c->ci[-1 - caller_level].

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@lemmuh
Comment options

@dearblue
Comment options

Answer selected by lemmuh
@lemmuh
Comment options

Comment options

You must be logged in to vote
1 reply
@dearblue
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants