Skip to content

Commit

Permalink
[IR] [1.9] Couple more special/corner cases fixed in block arg setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
subbuss committed Dec 24, 2011
1 parent 9751b33 commit 6385f9a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/org/jruby/runtime/InterpretedIRBlockBody19.java
Expand Up @@ -27,7 +27,7 @@ private IRubyObject[] convertValueIntoArgArray(ThreadContext context, IRubyObjec
if (isArray) {
RubyArray a = ((RubyArray)value);
int n = a.size();
if (a.size() == 0) value = context.nil;
if (a.size() == 0) value = isYieldSpecific ? RubyArray.newEmptyArray(context.getRuntime()) : context.nil;
else if (!isYieldSpecific) value = a.eltInternal(0);
}
return new IRubyObject[] { value };
Expand Down Expand Up @@ -91,7 +91,8 @@ public IRubyObject[] prepareArgumentsForCall(ThreadContext context, IRubyObject[
case NORMAL:
case PROC: {
if (args.length == 1) {
args = convertValueIntoArgArray(context, args[0], false, false);
// Convert value to arg-array, unwrapping where necessary
args = convertValueIntoArgArray(context, args[0], false, (type == Block.Type.NORMAL) && (args[0] instanceof RubyArray));
} else if (blockArity == 1) {
// discard excess arguments
args = (args.length == 0) ? context.getRuntime().getSingleNilArray() : new IRubyObject[] { args[0] };
Expand Down

0 comments on commit 6385f9a

Please sign in to comment.