First off, why is there an eval.c that has several structs defined that
would probably be better to have defined in an eval.h file? (but there is
no eval.h file)
I’m trying to access a member of the BLOCK structure that is defined in
eval.c in an extension.
Here’s the definition in eval.c:
struct BLOCK {
NODE *var;
NODE *body;
VALUE self;
struct FRAME frame;
struct SCOPE *scope;
struct BLOCKTAG *tag;
VALUE klass;
int iter;
int vmode;
int flags;
struct RVarmap *dyna_vars;
VALUE orig_thread;
VALUE wrapper;
struct BLOCK *prev;
};
…
static struct BLOCK *ruby_block;
I want to access the ‘body’ member of the struct and use it to get the AST
for a proc. It seems to me that if these structs were defined in an
eval.h file, that would be easier
Like you said you are trying to do something weird ...
pigeon% ruby -rii -e 'a = Proc.new {|i| i += 1}; dump a'
Proc
nd_var
DASGN_CURR i
nd_body
NEWLINE <-e:1>
DASGN_CURR i
CALL +
DVAR i
ARRAY
LIT 1
pigeon%
I want to access the 'body' member of the struct and use it to get the AST
for a proc. It seems to me that if these structs were defined in an
eval.h file, that would be easier