ruby-changes:51334
From: nobu <ko1@a...>
Date: Thu, 31 May 2018 18:30:53 +0900 (JST)
Subject: [ruby-changes:51334] nobu:r63540 (trunk): vm_args.c: refined warning splat to var
nobu 2018-05-31 18:30:49 +0900 (Thu, 31 May 2018) New Revision: 63540 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63540 Log: 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. Modified files: trunk/vm_args.c Index: vm_args.c =================================================================== --- vm_args.c (revision 63539) +++ vm_args.c (revision 63540) @@ -671,8 +671,15 @@ setup_parameters_complex(rb_execution_co https://github.com/ruby/ruby/blob/trunk/vm_args.c#L671 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) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/