diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-04-10 19:07:22 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-04-10 19:11:35 +0900 |
| commit | 4776ac50ed39652e56a084475a5d79c1bbccc6c0 (patch) | |
| tree | f1b157963c1966f309953d256d26c19c53af27e7 /src | |
| parent | 88ac7549c08411b8d96a7ed0ed8ab2299228f28f (diff) | |
| download | mruby-4776ac50ed39652e56a084475a5d79c1bbccc6c0.tar.gz mruby-4776ac50ed39652e56a084475a5d79c1bbccc6c0.zip | |
Remove too aggressive `initialize` call in `mrb_instance_new`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/class.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/class.c b/src/class.c index 6f6b3feda..d6efdbdc4 100644 --- a/src/class.c +++ b/src/class.c @@ -1505,22 +1505,13 @@ mrb_instance_new(mrb_state *mrb, mrb_value cv) mrb_value *argv; mrb_int argc; mrb_sym init; - mrb_method_t m; mrb_get_args(mrb, "*&", &argv, &argc, &blk); obj = mrb_instance_alloc(mrb, cv); init = mrb_intern_lit(mrb, "initialize"); - m = mrb_method_search(mrb, mrb_class(mrb, obj), init); - if (MRB_METHOD_CFUNC_P(m)) { - mrb_func_t f = MRB_METHOD_CFUNC(m); - if (f != mrb_bob_init) { - f(mrb, obj); - } - } - else { + if (!mrb_func_basic_p(mrb, obj, init, mrb_bob_init)) { mrb_funcall_with_block(mrb, obj, init, argc, argv, blk); } - return obj; } |
