aboutsummaryrefslogtreecommitdiffstats
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-09-13 17:02:08 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-11-29 17:32:27 +0900
commit191ce5344ec42c91571f8f47c85be9138262b1c7 (patch)
tree5f9f222cc5bfe870208673ceb3eba95c7a823239 /vm_insnhelper.c
parent3a87826d0c3dd4c42e327e0cd4fb0806d898497f (diff)
downloadruby-191ce5344ec42c91571f8f47c85be9138262b1c7.tar.gz
Reduce duplicated warnings for the change of Ruby 3 keyword arguments
By this change, the following code prints only one warning. ``` def foo(**opt); end 100.times { foo({kw:1}) } ``` A global variable `st_table *caller_to_callees` is a map from caller to a set of callee methods. It remembers that a warning is already printed for each pair of caller and callee. [Feature #16289]
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 94fc7c72bd..9eb349d54e 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2926,7 +2926,7 @@ vm_call_method_each_type(rb_execution_context_t *ec, rb_control_frame_t *cfp, st
case VM_METHOD_TYPE_ATTRSET:
CALLER_SETUP_ARG(cfp, calling, ci);
if (calling->argc == 1 && calling->kw_splat && RHASH_EMPTY_P(cfp->sp[-1])) {
- rb_warn_keyword_to_last_hash(calling, ci, NULL);
+ rb_warn_keyword_to_last_hash(ec, calling, ci, NULL);
}
else {
CALLER_REMOVE_EMPTY_KW_SPLAT(cfp, calling, ci);
@@ -3264,7 +3264,7 @@ vm_callee_setup_block_arg(rb_execution_context_t *ec, struct rb_calling_info *ca
CALLER_SETUP_ARG(cfp, calling, ci);
if (calling->kw_splat && calling->argc == iseq->body->param.lead_num + iseq->body->param.post_num && RHASH_EMPTY_P(cfp->sp[-1])) {
- rb_warn_keyword_to_last_hash(calling, ci, iseq);
+ rb_warn_keyword_to_last_hash(ec, calling, ci, iseq);
}
else {
CALLER_REMOVE_EMPTY_KW_SPLAT(cfp, calling, ci);