diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-06-23 09:02:53 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-06-23 09:02:53 +0900 |
| commit | c938b2f65647aae87a7bcfeb3a9462b90aaa0ce4 (patch) | |
| tree | 9cbeb589b6b05cfae63194ddec61642131a0f499 /src/proc.c | |
| parent | a26599b5c6f5079ffaec791da279d425a20117b1 (diff) | |
| parent | 907a29979071e14fd0cc00a56401ee1d55bef6c6 (diff) | |
| download | mruby-c938b2f65647aae87a7bcfeb3a9462b90aaa0ce4.tar.gz mruby-c938b2f65647aae87a7bcfeb3a9462b90aaa0ce4.zip | |
Merge pull request #2399 from ksss/cfunc-proc
Proc class should be defined before a first method definition
Diffstat (limited to 'src/proc.c')
| -rw-r--r-- | src/proc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/proc.c b/src/proc.c index d4fe86680..a61296ed4 100644 --- a/src/proc.c +++ b/src/proc.c @@ -149,9 +149,14 @@ mrb_proc_arity(mrb_state *mrb, mrb_value self) { struct RProc *p = mrb_proc_ptr(self); mrb_code *iseq = mrb_proc_iseq(mrb, p); - mrb_aspec aspec = GETARG_Ax(*iseq); + mrb_aspec aspec; int ma, ra, pa, arity; + if (MRB_PROC_CFUNC_P(p)) { + // TODO cfunc aspec not implemented yet + return mrb_fixnum_value(-1); + } + aspec = GETARG_Ax(*iseq); ma = MRB_ASPEC_REQ(aspec); ra = MRB_ASPEC_REST(aspec); pa = MRB_ASPEC_POST(aspec); @@ -201,9 +206,6 @@ mrb_init_proc(mrb_state *mrb) call_irep->iseq = call_iseq; call_irep->ilen = 1; - mrb->proc_class = mrb_define_class(mrb, "Proc", mrb->object_class); /* 15.2.17 */ - MRB_SET_INSTANCE_TT(mrb->proc_class, MRB_TT_PROC); - mrb_define_method(mrb, mrb->proc_class, "initialize", mrb_proc_initialize, MRB_ARGS_NONE()); mrb_define_method(mrb, mrb->proc_class, "initialize_copy", mrb_proc_init_copy, MRB_ARGS_REQ(1)); mrb_define_method(mrb, mrb->proc_class, "arity", mrb_proc_arity, MRB_ARGS_NONE()); |
