summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-09-25 15:49:21 -0700
committerJeremy Evans <code@jeremyevans.net>2019-11-18 01:00:25 +0200
commitc257303ae78d0e307a80dbe5ccd405abc6e8d44d (patch)
tree7ac3c50cb98d43f930bf82bafca7ffbcea39e119 /vm_eval.c
parentd03da13b17484cb3f8697e9125e028eb65ef7a39 (diff)
Deprecate rb_eval_cmd, add rb_eval_cmd_kw
rb_eval_cmd takes a safe level, and now that $SAFE is deprecated, it should be deprecated as well. Replace with rb_eval_cmd_kw, which takes a keyword flag. Switch the two callers to this function.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2476
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 8b557fab1c..c3f12d7836 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1777,7 +1777,7 @@ rb_eval_string_wrap(const char *str, int *pstate)
}
VALUE
-rb_eval_cmd(VALUE cmd, VALUE arg, int _level)
+rb_eval_cmd_kw(VALUE cmd, VALUE arg, int kw_splat)
{
enum ruby_tag_type state;
volatile VALUE val = Qnil; /* OK */
@@ -1786,8 +1786,8 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int _level)
EC_PUSH_TAG(ec);
if ((state = EC_EXEC_TAG()) == TAG_NONE) {
if (!RB_TYPE_P(cmd, T_STRING)) {
- val = rb_funcallv(cmd, idCall, RARRAY_LENINT(arg),
- RARRAY_CONST_PTR(arg));
+ val = rb_funcallv_kw(cmd, idCall, RARRAY_LENINT(arg),
+ RARRAY_CONST_PTR(arg), kw_splat);
}
else {
val = eval_string_with_cref(rb_vm_top_self(), cmd, NULL, 0, 0);
@@ -1799,6 +1799,13 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int _level)
return val;
}
+VALUE
+rb_eval_cmd(VALUE cmd, VALUE arg, int _level)
+{
+ rb_warn("rb_eval_cmd will be removed in Ruby 3.0");
+ return rb_eval_cmd_kw(cmd, arg, RB_NO_KEYWORDS);
+}
+
/* block eval under the class/module context */
static VALUE