aboutsummaryrefslogtreecommitdiffstats
path: root/vm_args.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-04-19 22:19:41 +0900
committerJeremy Evans <code@jeremyevans.net>2019-08-30 12:39:31 -0700
commit6a9ce1fea89bc5c6518dd6bb7ff3b824a9321976 (patch)
treed1e954802cfcb8fafb71b2e16dd7d957326d70d7 /vm_args.c
parentafae8555da07b2349a245d6646e3b36a49f027d5 (diff)
downloadruby-6a9ce1fea89bc5c6518dd6bb7ff3b824a9321976.tar.gz
Support **nil syntax for specifying a method does not accept keyword arguments
This syntax means the method should be treated as a method that uses keyword arguments, but no specific keyword arguments are supported, and therefore calling the method with keyword arguments will raise an ArgumentError. It is still allowed to double splat an empty hash when calling the method, as that does not pass any keyword arguments.
Diffstat (limited to 'vm_args.c')
-rw-r--r--vm_args.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vm_args.c b/vm_args.c
index 4e404870da..4eccb62da6 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -702,6 +702,10 @@ setup_parameters_complex(rb_execution_context_t * const ec, const rb_iseq_t * co
args->rest = Qfalse;
}
+ if (kw_flag && iseq->body->param.flags.accepts_no_kwarg) {
+ rb_raise(rb_eArgError, "no keywords accepted");
+ }
+
switch (arg_setup_type) {
case arg_setup_method:
break; /* do nothing special */