class.c: call method_added hooks on alias definitions; #2339

This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-06-25 10:10:34 +09:00
parent 888be9611b
commit 5fc301f07d
2 changed files with 5 additions and 1 deletions
+3
View File
@@ -2282,6 +2282,8 @@ mrb_mod_to_s(mrb_state *mrb, mrb_value klass)
}
}
void mrb_method_added(mrb_state *mrb, struct RClass *c, mrb_sym mid);
static mrb_value
mrb_mod_alias(mrb_state *mrb, mrb_value mod)
{
@@ -2290,6 +2292,7 @@ mrb_mod_alias(mrb_state *mrb, mrb_value mod)
mrb_get_args(mrb, "nn", &new_name, &old_name);
mrb_alias_method(mrb, c, new_name, old_name);
mrb_method_added(mrb, c, new_name);
return mod;
}
+2 -1
View File
@@ -2921,7 +2921,8 @@ RETRY_TRY_BLOCK:
if (!check_target_class(mrb)) goto L_RAISE;
target = mrb_vm_ci_target_class(mrb->c->ci);
mrb_alias_method(mrb, target, syms[a], syms[b]);
NEXT;
mrb_method_added(mrb, target, syms[a]);
NEXT;
}
CASE(OP_UNDEF, B) {
struct RClass *target;