mruby-proc-ext/proc.c (mrb_proc_parameters): skip empty block slot.

Unlike other formal arguments, a block argument has an empty slot even
when the block is not given.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-09-30 07:49:44 +09:00
parent 7667b0fc04
commit 3a2de4af00
+2
View File
@@ -176,6 +176,8 @@ mrb_proc_parameters(mrb_state *mrb, mrb_value self)
}
mrb_ary_push(mrb, parameters, a);
}
/* need to skip empty block slot */
if (p->size == 0 && p->name == MRB_SYM(block)) i++;
}
if (!mrb_nil_p(krest)) mrb_ary_push(mrb, parameters, krest);
if (!mrb_nil_p(block)) mrb_ary_push(mrb, parameters, block);