mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
correctly handle *splat arguments in mrb_get_argc, also add mrb_vm_get_argc and mrb_get_argv
Fixes #3825
This commit is contained in:
+11
-1
@@ -858,12 +858,22 @@ mrb_get_mid(mrb_state *mrb) /* get method symbol */
|
||||
return mrb->c->ci->mid;
|
||||
}
|
||||
|
||||
/* returns -1 for *splat arguments */
|
||||
static inline mrb_int
|
||||
mrb_get_argc(mrb_state *mrb) /* get argc */
|
||||
mrb_vm_get_argc(mrb_state *mrb) /* get argc */
|
||||
{
|
||||
return mrb->c->ci->argc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve number of arguments from mrb_state.
|
||||
*
|
||||
* Correctly handles *splat arguments.
|
||||
*/
|
||||
MRB_API mrb_int mrb_get_argc(mrb_state *mrb);
|
||||
|
||||
MRB_API mrb_value* mrb_get_argv(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:
|
||||
|
||||
Reference in New Issue
Block a user