aboutsummaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-01-19 11:34:26 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-08-31 22:14:14 +0900
commit2e80c8347e27f8ecedab56bab105d69efa35cbea (patch)
tree6f6ba778bf5f0808dd59e9d5b93ab44cc3be8980 /vm_eval.c
parentc23c880f56b3884c08a13c7e8c11ec4c89708a59 (diff)
downloadruby-2e80c8347e27f8ecedab56bab105d69efa35cbea.tar.gz
Deprecate iterator? method
[Feature #15547] [Fix GH-2071]
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/vm_eval.c b/vm_eval.c
index e086125989..3ada33e128 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -2312,7 +2312,6 @@ rb_f_local_variables(VALUE _)
/*
* call-seq:
* block_given? -> true or false
- * iterator? -> true or false
*
* Returns <code>true</code> if <code>yield</code> would execute a
* block in the current context. The <code>iterator?</code> form
@@ -2330,7 +2329,6 @@ rb_f_local_variables(VALUE _)
* try do "hello" end #=> "hello"
*/
-
static VALUE
rb_f_block_given_p(VALUE _)
{
@@ -2346,6 +2344,20 @@ rb_f_block_given_p(VALUE _)
}
}
+/*
+ * call-seq:
+ * iterator? -> true or false
+ *
+ * Deprecated. Use block_given? instead.
+ */
+
+static VALUE
+rb_f_iterator_p(VALUE self)
+{
+ rb_warn_deprecated("iterator?", "block_given?");
+ return rb_f_block_given_p(self);
+}
+
VALUE
rb_current_realfilepath(void)
{
@@ -2361,7 +2373,7 @@ Init_vm_eval(void)
{
rb_define_global_function("eval", rb_f_eval, -1);
rb_define_global_function("local_variables", rb_f_local_variables, 0);
- rb_define_global_function("iterator?", rb_f_block_given_p, 0);
+ rb_define_global_function("iterator?", rb_f_iterator_p, 0);
rb_define_global_function("block_given?", rb_f_block_given_p, 0);
rb_define_global_function("catch", rb_f_catch, -1);