diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-11-29 16:51:13 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-11-29 16:51:13 +0900 |
commit | 3a87826d0c3dd4c42e327e0cd4fb0806d898497f (patch) | |
tree | 5c52f4909eea084529e8b2f7f1647b64f95be7f5 /vm_method.c | |
parent | 5ad32d5504499f1a915d5d30e59dfd98da6759c6 (diff) |
vm_method.c: add top-level ruby2_keywords
This is a top-level version of Module#ruby2_keywords.
It can be used for functions (top-level methods) that delegates
arguments. [Feature #16364]
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/vm_method.c b/vm_method.c index 9b34ce17ae..1a6b1cfeaf 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1949,6 +1949,19 @@ top_private(int argc, VALUE *argv, VALUE _) /* * call-seq: + * ruby2_keywords(method_name, ...) -> self + * + * For the given method names, marks the method as passing keywords through + * a normal argument splat. See Module#ruby2_keywords in detail. + */ +static VALUE +top_ruby2_keywords(int argc, VALUE *argv, VALUE module) +{ + return rb_mod_ruby2_keywords(argc, argv, rb_cObject); +} + +/* + * call-seq: * module_function(symbol, ...) -> self * module_function(string, ...) -> self * @@ -2280,6 +2293,8 @@ Init_eval_method(void) "public", top_public, -1); rb_define_private_method(rb_singleton_class(rb_vm_top_self()), "private", top_private, -1); + rb_define_private_method(rb_singleton_class(rb_vm_top_self()), + "ruby2_keywords", top_ruby2_keywords, -1); { #define REPLICATE_METHOD(klass, id) do { \ |