summaryrefslogtreecommitdiff
path: root/enumerator.c
Commit message (Collapse)AuthorAgeFilesLines
* Use "Fiber storage variables" consistentlyBenoit Daloze2022-12-201-8/+8
|
* Improve documentation for fiber-scoped variablesBenoit Daloze2022-12-201-7/+38
| | | | * Especially around Enumerator.
* Never use the storage of another Fiber, that violates the whole designBenoit Daloze2022-12-201-2/+1
| | | | * See https://bugs.ruby-lang.org/issues/19078#note-30
* Reject keyword arguments given to Enumerator::Product.newAkinori MUSHA2022-12-161-10/+23
| | | | The use of keyword arguments should be reserved for future extension.
* Introduce `Fiber#storage` for inheritable fiber-scoped variables. (#6612)Samuel Williams2022-12-011-1/+2
|
* `remain` no longer starts with 0Nobuyoshi Nakada2022-11-251-7/+2
|
* [Bug #18971] Add precheck to enumeratorNobuyoshi Nakada2022-11-251-13/+36
|
* Using UNDEF_P macroS-H-GAMELINKS2022-11-161-17/+17
|
* Fix Array#[] with ArithmeticSequence with negative steps (#5739)Jeremy Evans2022-08-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | * Fix Array#[] with ArithmeticSequence with negative steps Previously, Array#[] when called with an ArithmeticSequence with a negative step did not handle all cases correctly, especially cases involving infinite ranges, inverted ranges, and/or exclusive ends. Fixes [Bug #18247] * Add Array#slice tests for ArithmeticSequence with negative step to test_array Add tests of rb_arithmetic_sequence_beg_len_step C-API function. * Fix ext/-test-/arith_seq/beg_len_step/depend * Rename local variables * Fix a variable name Co-authored-by: Kenta Murata <3959+mrkn@users.noreply.github.com>
* Adjust styles [ci skip]Nobuyoshi Nakada2022-08-061-8/+16
|
* Implement Enumerator::Product and Enumerator.product [Feature #18685]Akinori MUSHA2022-07-301-1/+353
|
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-221/+221
| | | | [Misc #18891]
* Introduce `RBIMPL_NONNULL_ARG` macroNobuyoshi Nakada2021-09-271-5/+3
| | | | | Runtime assertion for the argument declared as non-null. This macro does nothing if `RBIMPL_ATTR_NONNULL` is effective, otherwise asserts that the argument is non-null.
* Comparing nonnull argument to NULL is uselessNobuyoshi Nakada2021-09-231-0/+2
|
* Using RB_FLOAT_TYPE_P macroS-H-GAMELINKS2021-09-121-1/+1
|
* Replace RBOOL macroS-H-GAMELINKS2021-09-051-1/+1
|
* Adjust styles [ci skip]Nobuyoshi Nakada2021-06-171-2/+4
| | | | | | | | | * --braces-after-func-def-line * --dont-cuddle-else * --procnames-start-lines * --space-after-for * --space-after-if * --space-after-while
* Fix lazy enumerator with index sizeJeremy Evans2021-05-271-1/+6
| | | | Fixes [Bug #17889]
* Fix documentation for Enumerator::Lazy#with_indexJeremy Evans2021-04-091-1/+2
| | | | | | | If a block is given, it returns a lazy enumerator that will iterate over the block, it doesn't iterate over the block immediately. Fixes [Bug #17789]
* Undef Enumerator::Chain#{feed,next,next_values,peek,peek_values}Jeremy Evans2021-03-061-0/+5
| | | | | Previously these methods were defined but raised TypeError, which seems worse.
* Make Enumerator#{+,chain} create lazy chain if any included enumerator is lazyJeremy Evans2021-03-061-5/+16
| | | | Implements [Feature #17347]
* Fix calling enumerator methods such as with_index on Enumerator::ChainJeremy Evans2021-03-061-16/+14
| | | | | | | This previously raised a TypeError. Wrap the Enumerator::Chain in an Enumerator to work around the problem. Fixes [Bug #17216]
* Replace `Kernel.#open` with `URI.open` in docMasataka Pocke Kuwabara2021-01-081-2/+2
| | | | Because `Kernel.#open` no longer opens URI since Ruby 3.0.
* Add Enumerable#compact and Enumerator::Lazy#compactzverok2021-01-021-0/+25
|
* Enumerator.new: raise unless block given卜部昌平2020-12-221-43/+23
| | | | | Has been deprecated since c73b6bd7ebd01133538c645566944132dbde4d13. [Feature #17116] [ruby-dev:50945]
* Document usage of ArithmeticSequence in Array#slice, and add to NEWS (#3952)Victor Shepelev2020-12-211-0/+3
|
* Fix ArithmeticSequence#last and ArithmeticSequence#each for non-integer ↵Kenta Murata2020-12-091-8/+91
| | | | | | sequences (#3870) [Bug #17218] [ruby-core:100312]
* Removed more unnecessary ID cachesNobuyoshi Nakada2020-10-211-53/+54
| | | | | | | | | | ``` find . -name \*.o -exec nm {} + |& grep -e 'InitVM_.*\.rbimpl_id' -e 'Init_.*\.rbimpl_id' | sed 's/^.* b //;s/\.[1-9][0-9]*$//;s/\.rbimpl_id$//' | uniq ``` should be empty.
* Feature #16812: Allow slicing arrays with ArithmeticSequence (#3241)Kenta Murata2020-10-211-4/+40
| | | | | | | | | | | | | | | | | * Support ArithmeticSequence in Array#slice * Extract rb_range_component_beg_len * Use rb_range_values to check Range object * Fix ary_make_partial_step * Fix for negative step cases * range.c: Describe the role of err argument in rb_range_component_beg_len * Raise a RangeError when an arithmetic sequence refers the outside of an array [Feature #16812]
* RARRAY_AREF: convert into an inline function卜部昌平2020-08-151-1/+2
| | | | | | RARRAY_AREF has been a macro for reasons. We might not be able to change that for public APIs, but why not relax the situation internally to make it an inline function.
* Improved Enumerable::Lazy#zipNobuyoshi Nakada2020-07-231-42/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |compare-ruby|built-ruby| |:-------------------|-----------:|---------:| |first_ary | 290.514k| 296.331k| | | -| 1.02x| |first_nonary | 166.954k| 169.178k| | | -| 1.01x| |first_noarg | 299.547k| 305.358k| | | -| 1.02x| |take3_ary | 129.388k| 188.360k| | | -| 1.46x| |take3_nonary | 90.684k| 112.688k| | | -| 1.24x| |take3_noarg | 131.940k| 189.471k| | | -| 1.44x| |chain-first_ary | 195.913k| 286.194k| | | -| 1.46x| |chain-first_nonary | 127.483k| 168.716k| | | -| 1.32x| |chain-first_noarg | 201.252k| 298.562k| | | -| 1.48x| |chain-take3_ary | 101.189k| 183.188k| | | -| 1.81x| |chain-take3_nonary | 75.381k| 112.301k| | | -| 1.49x| |chain-take3_noarg | 101.483k| 192.148k| | | -| 1.89x| |block | 296.696k| 292.877k| | | 1.01x| -|
* Improved Enumerable::Lazy#flat_mapNobuyoshi Nakada2020-07-231-42/+40
| | | | | | | | | | | | | | | | | | | | |compare-ruby|built-ruby| |:-------|-----------:|---------:| |num3 | 96.333k| 160.732k| | | -| 1.67x| |num10 | 96.615k| 159.150k| | | -| 1.65x| |ary2 | 103.836k| 172.787k| | | -| 1.66x| |ary10 | 109.249k| 177.252k| | | -| 1.62x| |ary20 | 106.628k| 177.371k| | | -| 1.66x| |ary50 | 107.135k| 162.282k| | | -| 1.51x| |ary100 | 106.513k| 177.626k| | | -| 1.67x|
* New functions to pass more elements than passedNobuyoshi Nakada2020-07-231-4/+26
|
* Update Enumerable::Yielder#to_proc document (#3142)Masataka Pocke Kuwabara2020-05-261-1/+1
|
* Fix non-existent method reference in Enumerator.produce document (#3141)Masataka Pocke Kuwabara2020-05-261-1/+1
|
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Added more NORETURN declarationsNobuyoshi Nakada2020-05-111-3/+7
|
* Improve documentation for Enumerator#next, next_values, peek and peek_values.Marc-Andre Lafortune2020-05-051-7/+15
| | | | [DOC] [#16829]
* [ci skip] Enumerator doc cleanupgerero202020-04-111-3/+3
| | | | | | This is my first attempt at a pull request. I was reading the ruby docs the other day and noticed that the output didn't match the code sample on the with_object documentation. Inserted spaces to fix it.
* Suppress C4244 "possible loss of data" warningsNobuyoshi Nakada2020-04-081-1/+1
|
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+1
| | | Split ruby.h
* Removed duplicated codeNobuyoshi Nakada2020-02-091-30/+1
|
* Fully separate positional arguments and keyword argumentsJeremy Evans2020-01-021-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | This removes the warnings added in 2.7, and changes the behavior so that a final positional hash is not treated as keywords or vice-versa. To handle the arg_setup_block splat case correctly with keyword arguments, we need to check if we are taking a keyword hash. That case didn't have a test, but it affects real-world code, so add a test for it. This removes rb_empty_keyword_given_p() and related code, as that is not needed in Ruby 3. The empty keyword case is the same as the no keyword case in Ruby 3. This changes rb_scan_args to implement keyword argument separation for C functions when the : character is used. For backwards compatibility, it returns a duped hash. This is a bad idea for performance, but not duping the hash breaks at least Enumerator::ArithmeticSequence#inspect. Instead of having RB_PASS_CALLED_KEYWORDS be a number, simplify the code by just making it be rb_keyword_given_p().
* decouple internal.h headers卜部昌平2019-12-261-3/+11
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* [DOC] Improve docs for Enumerator.produce, Enumerator.newMarcus Stollsteimer2019-12-241-14/+12
|
* Fix typos of previous docs PRzverok2019-12-231-1/+1
| | | | | | In #2612 I made two typos (extra ,, and copy-pasted same line of code instead of showing two different ones), fixing them.
* Some fixes in Enumerator::Lazy docsMarcus Stollsteimer2019-12-221-23/+24
| | | | | | * fix list in #flat_map * fix wrong indentation in #filter_map and #with_index * other small fixes
* Added rb_warn_deprecatedNobuyoshi Nakada2019-12-191-1/+1
|
* Fix Enumerator::Lazy#with_indexJeremy Evans2019-12-111-65/+56
| | | | | | | | | | | | | | | | * Make it correctly handle lambdas * Make it iterate over the block if block is given The original implementation was flawed, based on lazy_set_method instead of lazy_add_method. Note that there is no implicit map when passing a block, the return value of the block passed to with_index is ignored, just as it is for Enumerator#with_index. Also like Enumerator#with_index, when called with a block, the return value is an enumerator without the index. Fixes [Bug #16414]