Project

General

Profile

Bug #6142 ยป lazy_zip_to_a.diff

shugo (Shugo Maeda), 03/16/2012 12:03 PM

View differences:

enumerator.c
}
static VALUE
lazy_zip_to_a(int argc, VALUE *argv, VALUE obj)
{
VALUE zip_args = rb_iv_get(obj, "zip_arguments");
long i;
if (!NIL_P(zip_args)) {
for (i = 0; i < RARRAY_LEN(zip_args); i++) {
rb_check_funcall(RARRAY_PTR(zip_args)[i], id_rewind, 0, 0);
}
}
return rb_call_super(argc, argv);
}
static VALUE
lazy_zip(int argc, VALUE *argv, VALUE obj)
{
VALUE ary;
VALUE ary, lazy;
int i;
if (rb_block_given_p()) {
......
rb_ary_push(ary, rb_funcall(argv[i], id_lazy, 0));
}
return rb_block_call(rb_cLazy, id_new, 1, &obj, lazy_zip_func, ary);
lazy = rb_block_call(rb_cLazy, id_new, 1, &obj, lazy_zip_func, ary);
rb_iv_set(lazy, "zip_arguments", ary);
rb_define_singleton_method(lazy, "to_a", lazy_zip_to_a, -1);
rb_define_singleton_method(lazy, "force", lazy_zip_to_a, -1);
return lazy;
}
static VALUE
    (1-1/1)