Set proper class to subclass of Array

More compatibility to CRuby.
This commit is contained in:
okkez
2017-03-29 07:59:28 +09:00
parent 5ec051fc34
commit 6dbe2272cf
2 changed files with 15 additions and 2 deletions
+7 -2
View File
@@ -242,14 +242,19 @@ mrb_ary_resize(mrb_state *mrb, mrb_value ary, mrb_int new_len)
}
static mrb_value
mrb_ary_s_create(mrb_state *mrb, mrb_value self)
mrb_ary_s_create(mrb_state *mrb, mrb_value klass)
{
mrb_value ary;
mrb_value *vals;
mrb_int len;
struct RArray *a;
mrb_get_args(mrb, "*", &vals, &len);
ary = mrb_ary_new_from_values(mrb, len, vals);
a = mrb_ary_ptr(ary);
a->c = mrb_class_ptr(klass);
return mrb_ary_new_from_values(mrb, len, vals);
return ary;
}
static void