singleton class needs to set __outer__; fixed #1983

parent 4c296991
...@@ -982,6 +982,10 @@ mrb_singleton_class(mrb_state *mrb, mrb_value v) ...@@ -982,6 +982,10 @@ mrb_singleton_class(mrb_state *mrb, mrb_value v)
} }
obj = mrb_basic_ptr(v); obj = mrb_basic_ptr(v);
prepare_singleton_class(mrb, obj); prepare_singleton_class(mrb, obj);
if (mrb->c && mrb->c->ci && mrb->c->ci->target_class) {
mrb_obj_iv_set(mrb, (struct RObject*)obj->c, mrb_intern_lit(mrb, "__outer__"),
mrb_obj_value(mrb->c->ci->target_class));
}
return mrb_obj_value(obj->c); return mrb_obj_value(obj->c);
} }
......
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