|
38 | 38 |
|
39 | 39 | import java.io.IOException; |
40 | 40 | import java.util.List; |
41 | | - |
42 | 41 | import org.jcodings.Encoding; |
43 | 42 | import org.jruby.anno.JRubyClass; |
44 | 43 | import org.jruby.anno.JRubyMethod; |
45 | 44 | import org.jruby.exceptions.JumpException; |
46 | 45 | import org.jruby.exceptions.RaiseException; |
47 | | -import org.jruby.runtime.CallSite; |
48 | | -import org.jruby.runtime.Helpers; |
49 | 46 | import org.jruby.runtime.Block; |
50 | 47 | import org.jruby.runtime.BlockCallback; |
51 | 48 | import org.jruby.runtime.CallBlock; |
| 49 | +import org.jruby.runtime.CallSite; |
52 | 50 | import org.jruby.runtime.ClassIndex; |
| 51 | +import org.jruby.runtime.Helpers; |
53 | 52 | import org.jruby.runtime.JavaSites; |
54 | 53 | import org.jruby.runtime.ObjectAllocator; |
55 | 54 | import org.jruby.runtime.ObjectMarshal; |
56 | 55 | import org.jruby.runtime.Signature; |
57 | 56 | import org.jruby.runtime.ThreadContext; |
58 | | - |
59 | | -import static org.jruby.RubyEnumerator.enumeratorizeWithSize; |
60 | | -import static org.jruby.runtime.Visibility.*; |
61 | | - |
62 | 57 | import org.jruby.runtime.builtin.IRubyObject; |
63 | 58 | import org.jruby.runtime.builtin.Variable; |
64 | 59 | import org.jruby.runtime.callsite.RespondToCallSite; |
65 | 60 | import org.jruby.runtime.component.VariableEntry; |
| 61 | +import org.jruby.runtime.invokedynamic.MethodNames; |
66 | 62 | import org.jruby.runtime.marshal.MarshalStream; |
67 | 63 | import org.jruby.runtime.marshal.UnmarshalStream; |
68 | 64 | import org.jruby.util.ByteList; |
69 | 65 | import org.jruby.util.TypeConverter; |
70 | 66 |
|
71 | | -import static org.jruby.runtime.Helpers.invokedynamic; |
72 | 67 | import static org.jruby.RubyEnumerator.SizeFn; |
| 68 | +import static org.jruby.RubyEnumerator.enumeratorizeWithSize; |
73 | 69 | import static org.jruby.RubyNumeric.intervalStepSize; |
74 | | - |
75 | | -import org.jruby.runtime.invokedynamic.MethodNames; |
| 70 | +import static org.jruby.runtime.Helpers.invokedynamic; |
| 71 | +import static org.jruby.runtime.Visibility.PRIVATE; |
76 | 72 |
|
77 | 73 | /** |
78 | 74 | * @author jpetersen |
@@ -528,26 +524,7 @@ private void fixnumEach(ThreadContext context, Block block) { |
528 | 524 | } |
529 | 525 | to--; |
530 | 526 | } |
531 | | - long from = ((RubyFixnum) begin).getLongValue(); |
532 | | - if (block.getSignature() == Signature.NO_ARGUMENTS) { |
533 | | - final IRubyObject nil = context.nil; |
534 | | - long i; |
535 | | - for (i = from; i < to; i++) { |
536 | | - block.yield(context, nil); |
537 | | - } |
538 | | - if (i <= to) { |
539 | | - block.yield(context, nil); |
540 | | - } |
541 | | - } else { |
542 | | - final Ruby runtime = context.runtime; |
543 | | - long i; |
544 | | - for (i = from; i < to; i++) { |
545 | | - block.yield(context, RubyFixnum.newFixnum(runtime, i)); |
546 | | - } |
547 | | - if (i <= to) { |
548 | | - block.yield(context, RubyFixnum.newFixnum(runtime, i)); |
549 | | - } |
550 | | - } |
| 527 | + RubyInteger.fixnumUpto(context, ((RubyFixnum) begin).getLongValue(), to, block); |
551 | 528 | } |
552 | 529 |
|
553 | 530 | @Deprecated |
|
0 commit comments