Граф коммитов

180 Коммитов

Автор SHA1 Сообщение Дата
nobu 8a28e97ae9 enumerator.c: use VALUE
* enumerator.c (inspect_enumerator): use VALUE instead of mere char*
  by using rb_sprintf() and rb_id2str().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 02:05:17 +00:00
nobu 6b6ca88925 enumerator.c: append_method
* enumerator.c (append_method): extract from inspect_enumerator().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 02:03:07 +00:00
nobu 15b88811d6 enumerator.c: fix style
* enumerator.c (enumerator_initialize): no cuddle up else.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-18 01:58:00 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
zzak 9ef4e13459 * array.c: Document synonymous methods, by windwiny [GH-277]
* bignum.c: ditto
* complex.c: ditto
* dir.c: ditto
* encoding.c: ditto
* enumerator.c: ditto
* numeric.c: ditto
* proc.c: ditto
* re.c: ditto
* string.c: ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-12 02:59:07 +00:00
naruse 5f257cf403 * enumerator.c (enumerator_with_index): try to convert given offset to
integer. fix bug introduced in r39594.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-11 09:47:15 +00:00
kazu dbec401c11 use INT2FIX(0) instead of INT2NUM(0).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 16:31:19 +00:00
drbrain 6c77ae07a5 * enumerator.c (enumerator_with_index): Restore handling of a nil memo
from r39594.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 03:25:55 +00:00
nobu 4a429c11e1 enumerator.c: allow Bignum for with_index
* enumerator.c (enumerator_with_index_i): allow Bignum as offset, to
  get rid of conversion exception and integer overflow.
  [ruby-dev:47131] [Bug #8010]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 01:20:20 +00:00
marcandre 673e1b9276 * enumerator.c: rdoc fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-23 17:38:12 +00:00
nobu 4b81b403eb enumerator.c: suppress warnings
* enumerator.c (lazy_zip_arrays_func, lazy_zip_func, lazy_take_func),
  (lazy_drop_func, lazy_drop_while_func): suppress uninitialized
  instance vriable warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-20 03:15:32 +00:00
marcandre 757bbe8737 * enumerator.c: Remove rdoc that is obsolete because of lazy
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 05:52:39 +00:00
marcandre 1677cbce9d * enumerator.c: Use to_enum for Enumerable methods returning Enumerators.
This makes Lazy#cycle no longer needed, so it was removed.
  Make Enumerator#chunk and slice_before return lazy Enumerators.
  [Bug #7715]

* internal.h: Remove ref to rb_enum_cycle_size; no longer needed

* enum.c: Make enum_cycle_size static.

* test/ruby/test_lazy_enumerator.rb: Test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 03:49:59 +00:00
marcandre 44cd5f21e9 * enumerator.c: Finalize and document Lazy.new. [Bug #7248]
Add Lazy#to_enum and simplify Lazy#size.

* test/ruby/test_lazy_enumerator.rb: tests for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 03:49:41 +00:00
marcandre 5af821c6e9 * enumerator.c: Fix and improve rdoc for to_enum
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-05 03:49:22 +00:00
marcandre aab2f788d7 * enumerator.c (lazy_zip): raise error for bad arguments
[Bug #7706]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 07:50:33 +00:00
marcandre 1af390b1ea * enumerator.c: Optimize Lazy#zip when passed only arrays
[Bug #7706]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 07:05:42 +00:00
marcandre 41d6ba8765 * enumerator.c: Fix state handling for Lazy#zip
[bug #7696] [bug #7691]

* test/ruby/test_lazy_enumerator.rb: test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 06:24:22 +00:00
marcandre 9d94a1a5a1 * enumerator.c: Fix state handling for Lazy#drop
[bug #7696] [bug #7691]

* test/ruby/test_lazy_enumerator.rb: test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 06:23:42 +00:00
marcandre bcbeb5d008 * enumerator.c: Fix state handling for Lazy#drop_while
[bug #7696] [bug #7691]

* test/ruby/test_lazy_enumerator.rb: test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 06:23:07 +00:00
marcandre de0e887635 * enumerator.c: Fix state handling for Lazy#take
[bug #7696]

* test/ruby/test_lazy_enumerator.rb: test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-24 06:22:34 +00:00
shugo 7dd52f895f * enumerator.c (lazy_flat_map_func): flat_map should call each only
when the value of a block returns a forcable object.
  [ruby-core:51401] [Bug #7690]

* enumerator.c (lazy_flat_map): add documentation.

* test/ruby/test_lazy_enumerator.rb: related test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-14 08:36:15 +00:00
marcandre 8ca504214d * enumerator.c: Require block for Lazy#{take|drop}_while [Bug #7692]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-14 07:42:43 +00:00
marcandre 62e67609b6 * enumerator.c: Fix size for Enumerator::Lazy#flat_map
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-14 01:19:12 +00:00
marcandre 19c530d8c1 * enumerator.c: Fix rdoc typo (thanks to Yutaka HARA)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-13 00:19:10 +00:00
nobu e878df745c use RB_TYPE_P
* enumerator.c (enumerator_initialize), eval.c (rb_using_refinement),
  (add_activated_refinement), numeric.c (num_interval_step_size),
  parse.y (arg, match_op_gen, cond0), range.c (range_bsearch),
  vm_insnhelper.c (vm_get_iclass): use RB_TYPE_P() to optimize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-29 12:22:01 +00:00
nobu 66fd9d44d8 adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 15:25:28 +00:00
marcandre a68cc24a9e * include/ruby/intern.h: Restore rb_enumeratorize as it was before r37497
and introduce rb_enumeratorize_with_size instead. [#7302]

* enumerator.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-07 19:46:16 +00:00
nobu db54dc7215 enum.c: prefix
* enum.c (rb_enum_cycle_size): prefix with rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 22:52:52 +00:00
nobu 7f00f853d4 adjust style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 22:50:30 +00:00
marcandre 0814c4ac64 * enumerator.c: Support for lazy.cycle.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:16:58 +00:00
marcandre 7a31096255 * enumerator.c: Add support for lazy.drop.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:16:44 +00:00
marcandre 9aafa954aa * enumerator.c: Support for lazy.take.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:16:29 +00:00
marcandre 5dbbfc3b34 * enumerator.c: Support for lazy.{map|flat_map|...}.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:16:13 +00:00
marcandre c8426ce840 * enumerator.c: Support for lazy.size
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:15:59 +00:00
marcandre 57d596cdb4 * enumerator.c: Support #size for enumerators created from enumerators
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:10:35 +00:00
marcandre acfd34a6a9 * enumerator.c (obj_to_enum): Have #to_enum accept a block
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:10:20 +00:00
marcandre 610eeffa46 * enumerator: New method #size; constructor accepts size
[Feature #6636]

* include/ruby/intern.h: RETURN_SIZED_ENUMERATOR for support of
  sized enumerators

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:10:06 +00:00
marcandre c73b6bd7eb * enumerator.c (enumerator_initialize): Warn when using deprecated form
[Feature #6636]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 17:09:43 +00:00
nobu 2073258a7d obj_init_copy
* object.c (rb_obj_init_copy): should check if trusted too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-05 11:13:18 +00:00
nobu b0dd250dc9 use RB_TYPE_P() instead of comparison of TYPE()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23 07:13:21 +00:00
nagachika 4007da1792 * enumerator.c (lazy_take_func, lazy_take): multiple calls of
force/to_a method to Enumerator::Lazy#take should return same
  results. [ruby-dev:45634] [Bug #6428]

* test/ruby/test_lazy_enumerator.rb (test_take_recycle): add test for
  above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-13 15:24:40 +00:00
nobu b30aa26707 initialize IDs in advance.
* enumerator.c (Init_Enumerator): initialize IDs in advance.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-03 01:24:51 +00:00
nobu 63e8110bfc * enumerator.c (inspect_enumerator): suppress uninitialized
instance variable warnings.  [ruby-dev:45449][Bug #6214]
  patched by no6v (Nobuhiro IMAI).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-03 01:18:31 +00:00
shugo b9f67c4149 * enumerator.c (inspect_enumerator): show method arguments of
lazy enumerators correctly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-26 10:52:02 +00:00
shugo 0c9f66eb40 * enumerator (lazy_initialize): set the instance variable "receiver"
to include the receiver to the return value of inspect on a lazy
  enumerator directly created by Enumerator::Lazy.new.

* enumerator (RETURN_LAZY): don't set the instance variable "receiver".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-24 15:53:38 +00:00
shugo 6b885f6e74 * enumerator (enumerator_inspect): include the original receiver and
method name of Enumerator::Lazy in the result of inspect.
  [ruby-core:43345] [Bug #6159]

* enumerator (InitVM_Enumerator): don't use rb_define_alias for
  some methods such as collect in order to make rb_frame_this_func()
  return the correct method names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-24 15:17:31 +00:00
shugo ded27bf5dc * enumerator.c (lazy_flat_map_func): convert the block value to
Array if it doesn't respond to each.  [ruby-core:43334]
  [Bug #6155]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-19 08:22:29 +00:00
shugo 831898bd99 * enumerator.c (enumerable_lazy): add an example of take and first
to the documentation.  [ruby-core:43344] [Bug #6158]
  add the description of the behavior when a block is given to zip
  or cycle.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-19 06:41:02 +00:00
kazu 30c0db4a85 follow r35040
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16 22:05:31 +00:00