Skip to content

Commit

Permalink
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/src/main/java/org/jruby/runtime/IRBlockBody.java
Original file line number Diff line number Diff line change
@@ -120,7 +120,10 @@ private IRubyObject[] toAry(ThreadContext context, IRubyObject value) {
protected IRubyObject doYieldLambda(ThreadContext context, IRubyObject value, Binding binding, Type type) {
// Lambda does not splat arrays even if a rest arg is present when it wants a single parameter filled.
IRubyObject[] args;
if (signature.required() == 1 || signature.arityValue() == -1) {

if (value == null) { // no args case from BlockBody.yieldSpecific
args = IRubyObject.NULL_ARRAY;
} else if (signature.required() == 1 || signature.arityValue() == -1) {
args = new IRubyObject[] { value };
} else {
args = toAry(context, value);
@@ -138,7 +141,9 @@ public IRubyObject doYield(ThreadContext context, IRubyObject value, Binding bin
int blockArity = getSignature().arityValue();

IRubyObject[] args;
if (blockArity >= -1 && blockArity <= 1) {
if (value == null) { // no args case from BlockBody.yieldSpecific
args = IRubyObject.NULL_ARRAY;
} else if (blockArity >= -1 && blockArity <= 1) {
args = new IRubyObject[] { value };
} else {
args = toAry(context, value);

0 comments on commit 5a0e8cb

Please sign in to comment.