instance_eval should set target_class; close #2936

target_class should be singleton class of the receiver
parent eb9bec19
...@@ -235,12 +235,12 @@ f_instance_eval(mrb_state *mrb, mrb_value self) ...@@ -235,12 +235,12 @@ f_instance_eval(mrb_state *mrb, mrb_value self)
mrb_int len; mrb_int len;
char *file = NULL; char *file = NULL;
mrb_int line = 1; mrb_int line = 1;
mrb_value cv;
mrb_get_args(mrb, "s|zi", &s, &len, &file, &line); mrb_get_args(mrb, "s|zi", &s, &len, &file, &line);
c->ci->acc = CI_ACC_SKIP; c->ci->acc = CI_ACC_SKIP;
if (c->ci->target_class->tt == MRB_TT_ICLASS) { cv = mrb_singleton_class(mrb, self);
c->ci->target_class = c->ci->target_class->c; c->ci->target_class = mrb_class_ptr(cv);
}
return mrb_run(mrb, create_proc_from_string(mrb, s, len, mrb_nil_value(), file, line), self); return mrb_run(mrb, create_proc_from_string(mrb, s, len, mrb_nil_value(), file, line), self);
} }
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment