Fix Struct.new and Struct.[].

Instances of Struct's subclass should have MRB_TT_STRUCT.
This commit is contained in:
Masamitsu MURASE
2012-06-24 04:06:53 +09:00
parent a194f30f62
commit 7a17377c64
+2 -2
View File
@@ -286,8 +286,8 @@ make_struct(mrb_state *mrb, mrb_value name, mrb_value members, struct RClass * k
nstr = mrb_obj_value(c);
mrb_iv_set(mrb, nstr, mrb_intern(mrb, "__members__"), members);
mrb_define_class_method(mrb, c, "new", mrb_class_new_instance_m, ARGS_ANY());
mrb_define_class_method(mrb, c, "[]", mrb_class_new_instance_m, ARGS_ANY());
mrb_define_class_method(mrb, c, "new", mrb_instance_new, ARGS_ANY());
mrb_define_class_method(mrb, c, "[]", mrb_instance_new, ARGS_ANY());
mrb_define_class_method(mrb, c, "members", mrb_struct_s_members_m, ARGS_NONE());
//RSTRUCT(nstr)->basic.c->super = c->c;
ptr_members = RARRAY_PTR(members);