diff options
| author | ksss <[email protected]> | 2016-12-21 18:31:44 +0900 |
|---|---|---|
| committer | ksss <[email protected]> | 2016-12-22 10:40:13 +0900 |
| commit | a68b568911f5dbf762d26ba21e4171bc7a2473e5 (patch) | |
| tree | ccfde28ec25c50353593392ce094598d9ea1983b /src | |
| parent | 3cba13c249457cfb318c9d7d4456d99003442139 (diff) | |
| download | mruby-a68b568911f5dbf762d26ba21e4171bc7a2473e5.tar.gz mruby-a68b568911f5dbf762d26ba21e4171bc7a2473e5.zip | |
Should call initialize method if defined
Diffstat (limited to 'src')
| -rw-r--r-- | src/proc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/proc.c b/src/proc.c index 0fb38359f..a75774667 100644 --- a/src/proc.c +++ b/src/proc.c @@ -151,6 +151,7 @@ static mrb_value mrb_proc_s_new(mrb_state *mrb, mrb_value proc_class) { mrb_value blk; + mrb_value proc; struct RProc *p; mrb_get_args(mrb, "&", &blk); @@ -160,7 +161,9 @@ mrb_proc_s_new(mrb_state *mrb, mrb_value proc_class) } p = (struct RProc *)mrb_obj_alloc(mrb, MRB_TT_PROC, mrb_class_ptr(proc_class)); mrb_proc_copy(p, mrb_proc_ptr(blk)); - return mrb_obj_value(p); + proc = mrb_obj_value(p); + mrb_funcall_with_block(mrb, proc, mrb_intern_lit(mrb, "initialize"), 0, NULL, blk); + return proc; } static mrb_value |
