mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Revert "instance_eval for classes and modules should behave as class_eval."
This reverts commit ee3017496b.
I misunderstood something and the new behavior was different from CRuby.
The issue was reported by @dearblue, regarding #5478
This commit is contained in:
@@ -792,21 +792,11 @@ mrb_value
|
||||
mrb_obj_instance_eval(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
mrb_value a, b;
|
||||
struct RClass *c;
|
||||
|
||||
if (mrb_get_args(mrb, "|S&", &a, &b) == 1) {
|
||||
mrb_raise(mrb, E_NOTIMP_ERROR, "instance_eval with string not implemented");
|
||||
}
|
||||
switch (mrb_type(self)) {
|
||||
case MRB_TT_MODULE:
|
||||
case MRB_TT_CLASS:
|
||||
case MRB_TT_ICLASS:
|
||||
c = mrb_class_ptr(self);
|
||||
break;
|
||||
default:
|
||||
c = mrb_singleton_class_ptr(mrb, self);
|
||||
}
|
||||
return eval_under(mrb, self, b, c);
|
||||
return eval_under(mrb, self, b, mrb_singleton_class_ptr(mrb, self));
|
||||
}
|
||||
|
||||
MRB_API mrb_value
|
||||
|
||||
Reference in New Issue
Block a user