mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Handle keyword argument separation for Enumerator#size
When Object#to_enum is passed a block, the block is called to get a size with the arguments given to to_enum. This calls the block with the same keyword flag as to_enum is called with. This requires adding rb_check_funcall_kw and rb_check_funcall_default_kw to handle keyword flags.
This commit is contained in:
parent
27b6746872
commit
c9f2b790ad
5 changed files with 125 additions and 8 deletions
|
@ -1223,7 +1223,7 @@ enumerator_size(VALUE obj)
|
|||
argc = (int)RARRAY_LEN(e->args);
|
||||
argv = RARRAY_CONST_PTR(e->args);
|
||||
}
|
||||
size = rb_check_funcall(e->size, id_call, argc, argv);
|
||||
size = rb_check_funcall_kw(e->size, id_call, argc, argv, e->kw_splat);
|
||||
if (size != Qundef) return size;
|
||||
return e->size;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue