mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Call #initialize_copy from init_copy only if it's redefined.
This commit is contained in:
+5
-1
@@ -283,6 +283,8 @@ copy_class(mrb_state *mrb, mrb_value dst, mrb_value src)
|
||||
MRB_SET_INSTANCE_TT(dc, MRB_INSTANCE_TT(sc));
|
||||
}
|
||||
|
||||
static mrb_value mrb_obj_init_copy(mrb_state *mrb, mrb_value self);
|
||||
|
||||
static void
|
||||
init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj)
|
||||
{
|
||||
@@ -310,7 +312,9 @@ init_copy(mrb_state *mrb, mrb_value dest, mrb_value obj)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mrb_funcall_id(mrb, dest, MRB_SYM(initialize_copy), 1, obj);
|
||||
if (!mrb_func_basic_p(mrb, dest, MRB_SYM(initialize_copy), mrb_obj_init_copy)) {
|
||||
mrb_funcall_id(mrb, dest, MRB_SYM(initialize_copy), 1, obj);
|
||||
}
|
||||
}
|
||||
|
||||
/* 15.3.1.3.8 */
|
||||
|
||||
Reference in New Issue
Block a user