diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-30 06:20:09 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-06-30 06:20:09 +0000 |
commit | 639bd5e78fa7d83b44c892afccb99869a886e533 (patch) | |
tree | d33ef363870dccb8536cbcc1ab3a8780df92ff7f /range.c | |
parent | 00433666fd12d7e08c4c7c51593fc30265dd4508 (diff) | |
download | ruby-639bd5e78fa7d83b44c892afccb99869a886e533.tar.gz |
* eval.c (rb_eval): pre-evaluate argument for unambiguous
evaluation order. [ruby-dev:26383]
* lib/delegate.rb (Delegator::method_missing): forward unknown
method to the destination. suggested by
<christophe.poucet@gmail.com>. [ruby-talk:146776]
* process.c (detach_process_watcher): terminate process watcher
thread right after rb_waitpid() succeed. [ruby-talk:146430]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r-- | range.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -314,11 +314,11 @@ range_step(argc, argv, range) if (unit < 0) { rb_raise(rb_eArgError, "step can't be negative"); } + if (unit == 0) rb_raise(rb_eArgError, "step can't be 0"); if (FIXNUM_P(b) && FIXNUM_P(e)) { /* fixnums are special */ long end = FIX2LONG(e); long i; - if (unit == 0) rb_raise(rb_eArgError, "step can't be 0"); if (!EXCL(range)) end += 1; for (i=FIX2LONG(b); i<end; i+=unit) { rb_yield(LONG2NUM(i)); @@ -332,7 +332,6 @@ range_step(argc, argv, range) long iter[2]; b = tmp; - if (unit == 0) rb_raise(rb_eArgError, "step can't be 0"); args[0] = b; args[1] = e; args[2] = range; iter[0] = 1; iter[1] = unit; rb_iterate((VALUE(*)_((VALUE)))str_step, (VALUE)args, step_i, @@ -350,12 +349,10 @@ range_step(argc, argv, range) else { long args[2]; - if (unit == 0) rb_raise(rb_eArgError, "step can't be 0"); if (!rb_respond_to(b, id_succ)) { rb_raise(rb_eTypeError, "can't iterate from %s", rb_obj_classname(b)); } - args[0] = 1; args[1] = unit; range_each_func(range, step_i, b, e, args); |