|
37 | 37 | import org.jruby.anno.JRubyClass;
|
38 | 38 | import org.jruby.anno.JRubyMethod;
|
39 | 39 | import org.jruby.ast.util.ArgsUtil;
|
40 |
| -import org.jruby.common.RubyWarnings; |
41 | 40 | import org.jruby.exceptions.RaiseException;
|
42 |
| -import org.jruby.internal.runtime.methods.DynamicMethod; |
43 | 41 | import org.jruby.javasupport.JavaUtil;
|
44 | 42 | import org.jruby.runtime.Block;
|
45 | 43 | import org.jruby.runtime.CallSite;
|
|
50 | 48 | import org.jruby.runtime.ThreadContext;
|
51 | 49 | import org.jruby.runtime.Visibility;
|
52 | 50 | import org.jruby.runtime.builtin.IRubyObject;
|
53 |
| -import org.jruby.runtime.callsite.CachingCallSite; |
54 | 51 | import org.jruby.util.ByteList;
|
55 | 52 | import org.jruby.util.ConvertBytes;
|
56 | 53 | import org.jruby.util.ConvertDouble;
|
@@ -480,12 +477,11 @@ protected final RubyArray doCoerce(ThreadContext context, IRubyObject other, boo
|
480 | 477 | }
|
481 | 478 |
|
482 | 479 | private static RubyArray coerceResult(final Ruby runtime, final IRubyObject result, final boolean err) {
|
483 |
| - if (!(result instanceof RubyArray) || ((RubyArray) result).getLength() != 2 ) { |
484 |
| - if (err || !result.isNil()) throw runtime.newTypeError("coerce must return [x, y]"); |
485 |
| - return null; |
486 |
| - } |
| 480 | + if (result instanceof RubyArray && ((RubyArray) result).getLength() == 2) return (RubyArray) result; |
487 | 481 |
|
488 |
| - return (RubyArray) result; |
| 482 | + if (err || !result.isNil()) throw runtime.newTypeError("coerce must return [x, y]"); |
| 483 | + |
| 484 | + return null; |
489 | 485 | }
|
490 | 486 |
|
491 | 487 | /** coerce_rescue
|
@@ -952,9 +948,8 @@ else if (num instanceof RubyBignum) {
|
952 | 948 | return ((RubyBignum) num).isNegative(context).isTrue();
|
953 | 949 | }
|
954 | 950 | }
|
955 |
| - IRubyObject r = UNDEF; |
956 |
| - r = stepCompareWithZero(context, num); |
957 |
| - return !r.isTrue(); |
| 951 | + |
| 952 | + return !stepCompareWithZero(context, num).isTrue(); |
958 | 953 | }
|
959 | 954 |
|
960 | 955 | private IRubyObject stepCompareWithZero(ThreadContext context, IRubyObject num) {
|
|
0 commit comments