summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-12 08:16:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-12 08:16:47 +0000
commit3be926db2a5f33a0c5764bcab73f8f21432bec68 (patch)
tree9494395a606a91a2fba9891eae50e02222cab9b7 /enum.c
parentc28b5723f6615fa429fc5b2606eb1b5b43bdb197 (diff)
revert [Bug #9605]
* enum.c: revert r45284, r45286, r45292. it conflicts with existing behaviors. [Bug #9605] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/enum.c b/enum.c
index b0d3bca..cd2d49d 100644
--- a/enum.c
+++ b/enum.c
@@ -62,7 +62,7 @@ grep_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
ENUM_WANT_SVALUE();
if (RTEST(rb_funcall(memo->u1.value, id_eqq, 1, i))) {
- rb_ary_push(memo->u2.value, enum_yield(argc, argv));
+ rb_ary_push(memo->u2.value, rb_yield(i));
}
return Qnil;
}
@@ -180,7 +180,7 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{
ENUM_WANT_SVALUE();
- if (RTEST(enum_yield(argc, argv))) {
+ if (RTEST(rb_yield(i))) {
NODE *memo = RNODE(memop);
memo->u1.value = i;
memo->u3.cnt = 1;
@@ -303,7 +303,7 @@ find_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
ENUM_WANT_SVALUE();
- if (RTEST(enum_yield(argc, argv))) {
+ if (RTEST(rb_yield(i))) {
rb_ary_push(ary, i);
}
return Qnil;
@@ -355,7 +355,7 @@ reject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
ENUM_WANT_SVALUE();
- if (!RTEST(enum_yield(argc, argv))) {
+ if (!RTEST(rb_yield(i))) {
rb_ary_push(ary, i);
}
return Qnil;
@@ -674,7 +674,7 @@ partition_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arys))
VALUE ary;
ENUM_WANT_SVALUE();
- if (RTEST(enum_yield(argc, argv))) {
+ if (RTEST(rb_yield(i))) {
ary = memo->u1.value;
}
else {
@@ -720,7 +720,7 @@ group_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
ENUM_WANT_SVALUE();
- group = enum_yield(argc, argv);
+ group = rb_yield(i);
values = rb_hash_aref(hash, group);
if (!RB_TYPE_P(values, T_ARRAY)) {
values = rb_ary_new3(1, i);
@@ -846,7 +846,7 @@ sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _data))
ENUM_WANT_SVALUE();
- v = enum_yield(argc, argv);
+ v = rb_yield(i);
if (RBASIC(ary)->klass) {
rb_raise(rb_eRuntimeError, "sort_by reentered");
@@ -1249,7 +1249,7 @@ nmin_i(VALUE i, VALUE *_data, int argc, VALUE *argv)
ENUM_WANT_SVALUE();
if (data->by)
- rb_ary_push(data->buf, enum_yield(argc, argv));
+ rb_ary_push(data->buf, rb_yield(i));
rb_ary_push(data->buf, i);
data->curlen++;
@@ -1685,7 +1685,7 @@ min_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
ENUM_WANT_SVALUE();
- v = enum_yield(argc, argv);
+ v = rb_yield(i);
if (memo->u1.value == Qundef) {
memo->u1.value = v;
memo->u2.value = i;
@@ -1745,7 +1745,7 @@ max_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
ENUM_WANT_SVALUE();
- v = enum_yield(argc, argv);
+ v = rb_yield(i);
if (memo->u1.value == Qundef) {
memo->u1.value = v;
memo->u2.value = i;
@@ -1836,7 +1836,7 @@ minmax_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
ENUM_WANT_SVALUE();
- vi = enum_yield(argc, argv);
+ vi = rb_yield(i);
if (memo->last_bv == Qundef) {
memo->last_bv = vi;
@@ -2016,7 +2016,8 @@ enum_reverse_each(int argc, VALUE *argv, VALUE obj)
static VALUE
each_val_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
{
- enum_yield(argc, argv);
+ ENUM_WANT_SVALUE();
+ rb_yield(i);
return Qnil;
}
@@ -2246,7 +2247,7 @@ zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
}
}
if (NIL_P(result)) {
- rb_yield_splat(tmp);
+ rb_yield(tmp);
}
else {
rb_ary_push(result, tmp);
@@ -2294,7 +2295,7 @@ zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
}
}
if (NIL_P(result)) {
- rb_yield_splat(tmp);
+ rb_yield(tmp);
}
else {
rb_ary_push(result, tmp);
@@ -2488,7 +2489,7 @@ drop_while_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
- if (!memo->u3.state && !RTEST(enum_yield(argc, argv))) {
+ if (!memo->u3.state && !RTEST(rb_yield(i))) {
memo->u3.state = TRUE;
}
if (memo->u3.state) {
@@ -2531,9 +2532,8 @@ cycle_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
ENUM_WANT_SVALUE();
- if (argc == 1) i = rb_ary_new4(argc, argv);
rb_ary_push(ary, i);
- enum_yield(argc, argv);
+ rb_yield(i);
return Qnil;
}
@@ -2600,7 +2600,7 @@ enum_cycle(int argc, VALUE *argv, VALUE obj)
if (len == 0) return Qnil;
while (n < 0 || 0 < --n) {
for (i=0; i<len; i++) {
- rb_yield_splat(RARRAY_AREF(ary, i));
+ rb_yield(RARRAY_AREF(ary, i));
}
}
return Qnil;