Skip to content

Commit

Permalink
Bug fix in IRBuilder generating IR for an array literal
Browse files Browse the repository at this point in the history
* We have to assign every elt build to a temporary and use the tmp
  in the array construction.

* This fixes the buggy IR generated by the builder for the snippet
  in issue 2574.

* But, this exposes a bug in OptTempVarsPass that is opting that
  away incorrectly. Will fix that in a separate patch and also add
  a test for it at that time.
  • Loading branch information
subbuss committed Feb 7, 2015
1 parent a5fedf5 commit eb3740c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/IRBuilder.java
Expand Up @@ -782,7 +782,7 @@ public Operand buildAnd(final AndNode andNode) {
public Operand buildArray(Node node) {
List<Operand> elts = new ArrayList<>();
for (Node e: node.childNodes())
elts.add(build(e));
elts.add(copyAndReturnValue(build(e)));

return copyAndReturnValue(new Array(elts));
}
Expand Down

0 comments on commit eb3740c

Please sign in to comment.