summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-09-05 18:34:07 +0900
committerJeremy Evans <code@jeremyevans.net>2019-09-05 17:47:12 -0700
commitacee6302419f02792ec331d384f430c5fc6bdb70 (patch)
treec6c37d5533e516144dfde33f121a063d3be2211f
parenteda8dcea164b561359f638b1489d0ab12659c9a2 (diff)
vm_insnhelper.c: Do not read `ci->flag` after CALLER_SETUP_ARG
Actually, the following call is wrongly warned without this change. ``` class C def method_missing(x, *args, **opt) end end C.new.foo(k: 1) # warning: The last argument is used as the keyword parameter # warning: for `method_missing' defined here ```
-rw-r--r--vm_insnhelper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 55369c7cd9..8b8fb9467f 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2206,7 +2206,7 @@ vm_call_cfunc_with_frame(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp
int argc = calling->argc;
int orig_argc = argc;
- if (UNLIKELY(IS_ARGS_KW_OR_KW_SPLAT(ci))) {
+ if (UNLIKELY(calling->kw_splat)) {
frame_type |= VM_FRAME_FLAG_CFRAME_KW;
}
@@ -2417,7 +2417,7 @@ vm_call_method_missing(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp,
CALLER_SETUP_ARG(reg_cfp, calling, orig_ci, 0);
argc = calling->argc+1;
- ci_entry.flag = VM_CALL_FCALL | VM_CALL_OPT_SEND | (orig_ci->flag & VM_CALL_KW_SPLAT);
+ ci_entry.flag = VM_CALL_FCALL | VM_CALL_OPT_SEND | (calling->kw_splat ? VM_CALL_KW_SPLAT : 0);
ci_entry.mid = idMethodMissing;
ci_entry.orig_argc = argc;
ci = &ci_entry;