Additional patches to make this work

This commit is contained in:
Corey Powell
2015-07-11 11:15:18 +02:00
committed by Blaž Hrastnik
parent 97529c2a9a
commit 005cacf18b
2 changed files with 83 additions and 58 deletions
+12
View File
@@ -248,6 +248,11 @@ mrb_singleton_class_clone(mrb_state *mrb, mrb_value obj)
clone->c = mrb_singleton_class_clone(mrb, mrb_obj_value(klass));
}
if (klass->origin != klass)
clone->origin = klass->origin;
else
clone->origin = clone;
clone->super = klass->super;
if (klass->iv) {
mrb_iv_copy(mrb, mrb_obj_value(clone), mrb_obj_value(klass));
@@ -269,6 +274,13 @@ copy_class(mrb_state *mrb, mrb_value dst, mrb_value src)
{
struct RClass *dc = mrb_class_ptr(dst);
struct RClass *sc = mrb_class_ptr(src);
/* if the origin is not the same as the class, then the origin and
the current class need to be copied */
if (sc->origin != sc) {
dc->origin = mrb_class_ptr(mrb_obj_dup(mrb, mrb_obj_value(sc->origin)));
} else {
dc->origin = dc;
}
dc->mt = kh_copy(mt, mrb, sc->mt);
dc->super = sc->super;
}