remove String class initialization in error.c; ref #2429

parent 9a28ae92
......@@ -91,10 +91,15 @@ static mrb_value
exc_to_s(mrb_state *mrb, mrb_value exc)
{
mrb_value mesg = mrb_attr_get(mrb, exc, mrb_intern_lit(mrb, "mesg"));
struct RObject *p;
if (!mrb_string_p(mesg)) {
return mrb_str_new_cstr(mrb, mrb_obj_classname(mrb, exc));
}
p = mrb_obj_ptr(mesg);
if (!p->c) {
p->c = mrb->string_class;
}
return mesg;
}
......@@ -436,9 +441,6 @@ mrb_init_exception(mrb_state *mrb)
{
struct RClass *exception, *runtime_error, *script_error;
/* initialize mrb->string_class before creating RString object for nomem_err */
mrb->string_class = mrb_define_class(mrb, "String", mrb->object_class);
mrb->eException_class = exception = mrb_define_class(mrb, "Exception", mrb->object_class); /* 15.2.22 */
mrb_define_class_method(mrb, exception, "exception", mrb_instance_new, MRB_ARGS_ANY());
mrb_define_method(mrb, exception, "exception", exc_exception, MRB_ARGS_ANY());
......
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