mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Use RString in mesg instead.
This commit is contained in:
+11
-4
@@ -21,15 +21,22 @@
|
||||
static void
|
||||
exc_mesg_set(mrb_state *mrb, struct RException *exc, mrb_value mesg)
|
||||
{
|
||||
exc->flags |= MRB_EXC_MESG_INIT_FLAG;
|
||||
exc->mesg = mesg;
|
||||
mrb_field_write_barrier_value(mrb, (struct RBasic*)exc, mesg);
|
||||
if (mrb_string_p(mesg)) {
|
||||
exc->flags |= MRB_EXC_MESG_STRING_FLAG;
|
||||
exc->mesg = RSTRING(mesg);
|
||||
mrb_field_write_barrier_value(mrb, (struct RBasic*)exc, mesg);
|
||||
}
|
||||
else if (!mrb_nil_p(mesg)) {
|
||||
exc->flags &= ~MRB_EXC_MESG_STRING_FLAG;
|
||||
mrb_obj_iv_set(mrb, (struct RObject*)exc, mrb_intern_lit(mrb, "mesg"), mesg);
|
||||
}
|
||||
}
|
||||
|
||||
static mrb_value
|
||||
exc_mesg_get(mrb_state *mrb, struct RException *exc)
|
||||
{
|
||||
return (exc->flags & MRB_EXC_MESG_INIT_FLAG) != 0 ? exc->mesg : mrb_nil_value();
|
||||
return (exc->flags & MRB_EXC_MESG_STRING_FLAG) != 0
|
||||
? mrb_obj_value(exc->mesg) : mrb_obj_iv_get(mrb, (struct RObject*)exc, mrb_intern_lit(mrb, "mesg"));
|
||||
}
|
||||
|
||||
mrb_value
|
||||
|
||||
Reference in New Issue
Block a user