class.c (mrb_method_added): skip mrb_funcall_id() is possible

When `method_added` is not redefined, we don't need to call it since its
default implementation does nothing.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-02-16 09:38:26 +09:00
parent 2768fd62a0
commit 515b2fd144
+3 -1
View File
@@ -2550,7 +2550,9 @@ mrb_method_added(mrb_state *mrb, struct RClass *c, mrb_sym mid)
else {
added = MRB_SYM(method_added);
}
mrb_funcall_id(mrb, recv, added, 1, mrb_symbol_value(mid));
if (!mrb_func_basic_p(mrb, recv, added, mrb_do_nothing)) {
mrb_funcall_id(mrb, recv, added, 1, mrb_symbol_value(mid));
}
}
mrb_value