Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 6385f9ae9c24c718f45962dc008b9b019fb61b63 1 parent 9751b33
@subbuss subbuss authored
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] };
Please sign in to comment.
Something went wrong with that request. Please try again.