mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
remove #new from immediate classes
This commit is contained in:
+10
-4
@@ -1100,8 +1100,8 @@ mrb_mod_alias(mrb_state *mrb, mrb_value mod)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mrb_undef_method(mrb_state *mrb, struct RClass *c, mrb_sym a)
|
||||
static void
|
||||
undef_method(mrb_state *mrb, struct RClass *c, mrb_sym a)
|
||||
{
|
||||
mrb_value m;
|
||||
|
||||
@@ -1110,6 +1110,12 @@ mrb_undef_method(mrb_state *mrb, struct RClass *c, mrb_sym a)
|
||||
mrb_define_method_vm(mrb, c, a, m);
|
||||
}
|
||||
|
||||
void
|
||||
mrb_undef_method(mrb_state *mrb, struct RClass *c, const char *name)
|
||||
{
|
||||
undef_method(mrb, c, mrb_intern(mrb, name));
|
||||
}
|
||||
|
||||
mrb_value
|
||||
mrb_mod_undef(mrb_state *mrb, mrb_value mod)
|
||||
{
|
||||
@@ -1119,7 +1125,7 @@ mrb_mod_undef(mrb_state *mrb, mrb_value mod)
|
||||
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
while (argc--) {
|
||||
mrb_undef_method(mrb, c, mrb_symbol(*argv));
|
||||
undef_method(mrb, c, mrb_symbol(*argv));
|
||||
argv++;
|
||||
}
|
||||
return mrb_nil_value();
|
||||
@@ -1170,7 +1176,7 @@ mrb_init_class(mrb_state *mrb)
|
||||
mrb_name_class(mrb, mod, mrb_intern(mrb, "Module"));
|
||||
mrb_name_class(mrb, cls, mrb_intern(mrb, "Class"));
|
||||
|
||||
mrb_undef_method(mrb, mod, mrb_intern(mrb, "new"));
|
||||
mrb_undef_method(mrb, mod, "new");
|
||||
MRB_SET_INSTANCE_TT(cls, MRB_TT_CLASS);
|
||||
mrb_define_method(mrb, bob, "initialize", mrb_bob_init, ARGS_NONE());
|
||||
mrb_define_method(mrb, bob, "!", mrb_bob_not, ARGS_NONE());
|
||||
|
||||
Reference in New Issue
Block a user