Skip to content
Browse files

[IR] [1.9] Couple more special/corner cases fixed in block arg setup.

  • Loading branch information...
1 parent 9751b33 commit 6385f9ae9c24c718f45962dc008b9b019fb61b63 @subbuss subbuss committed Dec 24, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/org/jruby/runtime/InterpretedIRBlockBody19.java
View
5 src/org/jruby/runtime/InterpretedIRBlockBody19.java
@@ -27,7 +27,7 @@ public InterpretedIRBlockBody19(IRClosure closure, Arity arity, int argumentType
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 };
@@ -91,7 +91,8 @@ public IRubyObject yield(ThreadContext context, IRubyObject value, IRubyObject s
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] };

0 comments on commit 6385f9a

Please sign in to comment.
Something went wrong with that request. Please try again.