summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-09-05 19:29:25 +0900
committerJeremy Evans <code@jeremyevans.net>2019-09-05 17:47:12 -0700
commit55b96c5d2d7d8bcc2953484bd2f9c9519b252dae (patch)
tree98f96f1825d941fdf4bb9294f0cbcf9963911023 /vm_insnhelper.c
parentdd83f7bf98764b27385735f6f39dd090dc4854f9 (diff)
Add a keyword-to-last-hash warning for some case of define_method method
and lambda. When define_method is a simple iseq (`define_method(:m) {|x| ... }`), passing keywords to it (`m(**kw)`) didn't print a warning.
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 92a9bc6c9a..baf93de742 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2929,6 +2929,10 @@ vm_callee_setup_block_arg(rb_execution_context_t *ec, struct rb_calling_info *ca
CALLER_SETUP_ARG(cfp, calling, ci, 0); /* splat arg */
+ if (calling->kw_splat) {
+ rb_warn_keyword_to_last_hash(calling, ci, iseq);
+ }
+
if (arg_setup_type == arg_setup_block &&
calling->argc == 1 &&
iseq->body->param.flags.has_lead &&