aboutsummaryrefslogtreecommitdiffstats
path: root/vm_args.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-31 09:30:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-05-31 09:30:49 +0000
commitf6596f635bf315d706b9b0e6c9d5af4727816420 (patch)
treea9bbf405c36991beda3269558b8880a65ac1d8a8 /vm_args.c
parent007437b18e7539fb76674d83ef4fa8e9620f199f (diff)
downloadruby-f6596f635bf315d706b9b0e6c9d5af4727816420.tar.gz
vm_args.c: refined warning splat to var
* vm_args.c (setup_parameters_complex): refine the warning message for a splat hash which was passed to a single variable instead of keyword arguments. this behavior will be changed when the "real" keyword argument is introduced in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_args.c')
-rw-r--r--vm_args.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/vm_args.c b/vm_args.c
index c5a83b9946..3c1a2a3d75 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -671,8 +671,15 @@ setup_parameters_complex(rb_execution_context_t * const ec, const rb_iseq_t * co
argument_kw_error(ec, iseq, "unknown", rb_hash_keys(keyword_hash));
}
else if (kw_splat && NIL_P(keyword_hash)) {
- rb_warning("passing splat keyword arguments as a single Hash"
- " to `% "PRIsVALUE"'", rb_id2str(ci->mid));
+ if (RTEST(ruby_verbose)) {
+ VALUE path = rb_iseq_path(iseq);
+ VALUE line = rb_iseq_first_lineno(iseq);
+ VALUE label = rb_iseq_label(iseq);
+ rb_compile_warning(NIL_P(path) ? NULL : RSTRING_PTR(path), FIX2INT(line),
+ "in `%s': the last argument was passed as a single Hash",
+ NIL_P(label) ? NULL : RSTRING_PTR(label));
+ rb_warning("although a splat keyword arguments here");
+ }
}
if (iseq->body->param.flags.has_block) {