summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-10-17 15:07:05 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-10-17 15:07:05 +0900
commit344a7ce20c5e59a07fec65732f56d232eca8eef0 (patch)
treec9061e0c1621d1effd9bd9fe5cb14da006f0495d /include
parent4122c320bb8a81ff66eae72e25eda8af6c768683 (diff)
parentbe86d8b45fa5d83f1d1caba9c4c0893c6281f720 (diff)
downloadmruby-344a7ce20c5e59a07fec65732f56d232eca8eef0.tar.gz
mruby-344a7ce20c5e59a07fec65732f56d232eca8eef0.zip
Merge branch 'fix-get-argc' of https://github.com/dabroz/mruby into dabroz-fix-get-argc
Diffstat (limited to 'include')
-rw-r--r--include/mruby.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 316707909..54ba0ead4 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -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: