Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[IR] Discard additional "_" args in a block.

* Lets me run all MRI tests to completion with just a LinearizeCFG
  pass.

* Before this fix, the following snippet would have crashed with
  these args: -X-CIR -Xir.passes=LinearizeCFG

def foo
 yield [1,2,3,4]
end

foo { |a,_,_,_| p a }
  • Loading branch information...
commit d4ed739885758c482a8a7147f482cf934eeebb67 1 parent 7a58e62
@subbuss subbuss authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 core/src/main/java/org/jruby/ir/IRBuilder.java
View
6 core/src/main/java/org/jruby/ir/IRBuilder.java
@@ -1867,7 +1867,11 @@ public void receiveRequiredArg(Node node, IRScope s, int argIndex, boolean post,
ArgumentNode a = (ArgumentNode)node;
String argName = a.getName();
if (s instanceof IRMethod) ((IRMethod)s).addArgDesc("req", argName);
- addArgReceiveInstr(s, s.getNewLocalVariable(argName, 0), argIndex, post, numPreReqd, numPostRead);
+ // SSS FIXME: _$0 feels fragile?
+ // Ignore duplicate "_" args in blocks.
+ if (!argName.equals("_$0")) {
+ addArgReceiveInstr(s, s.getNewLocalVariable(argName, 0), argIndex, post, numPreReqd, numPostRead);
+ }
break;
}
case MULTIPLEASGN19NODE: {
Please sign in to comment.
Something went wrong with that request. Please try again.