Added MRB_API function to get block arguments info.

- ` mrb_block_given_p()` -- The name comes from CRuby's `rb_block_given_p ()`

At the same time, it applies to `f_instance_eval()` and `f_class_eval()` of `mruby-eval`.
This commit is contained in:
dearblue
2021-06-19 15:08:09 +09:00
committed by Yukihiro "Matz" Matsumoto
parent 43eddfd4d5
commit c40802865a
3 changed files with 20 additions and 14 deletions
+5
View File
@@ -1004,6 +1004,11 @@ MRB_API const mrb_value *mrb_get_argv(mrb_state *mrb);
*/
MRB_API mrb_value mrb_get_arg1(mrb_state *mrb);
/**
* Check if a block argument is given from mrb_state.
*/
MRB_API mrb_bool mrb_block_given_p(mrb_state *mrb);
/* `strlen` for character string literals (use with caution or `strlen` instead)
Adjacent string literals are concatenated in C/C++ in translation phase 6.
If `lit` is not one, the compiler will report a syntax error: