Skip to content

Commit

Permalink
I see no way a null is possible this deep
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Dec 5, 2016
1 parent 155ced6 commit 3a7b5a2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions core/src/main/java/org/jruby/RubyProc.java
Expand Up @@ -256,18 +256,14 @@ public IRubyObject call(ThreadContext context, IRubyObject[] args) {
* arity of one, etc.)
*/
public static IRubyObject[] prepareArgs(ThreadContext context, Block.Type type, BlockBody blockBody, IRubyObject[] args) {
Signature signature = blockBody.getSignature();

if (args == null) return IRubyObject.NULL_ARRAY;

if (type == Block.Type.LAMBDA) {
signature.checkArity(context.runtime, args);
blockBody.getSignature().checkArity(context.runtime, args);
return args;
}

// FIXME: weirdly nearly identical logic exists in prepareBlockArgsInternal but only for lambdas.
// for procs and blocks, single array passed to multi-arg must be spread
int arityValue = signature.arityValue();
int arityValue = blockBody.getSignature().arityValue();
if (args.length == 1 && (arityValue < -1 || arityValue > 1)) args = IRRuntimeHelpers.toAry(context, args);

// FIXME: This pruning only seems to be needed for calls through java block/calls CallBlock/JavaInternalBlockBody (move to those since pure-Ruby does not seem to need this.
Expand Down

0 comments on commit 3a7b5a2

Please sign in to comment.