Skip to content

Commit 7d44af4

Browse files
committed
Allow constantwrite to reuse result if provided one
1 parent 75b1688 commit 7d44af4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/jruby/prism/builder/IRBuilderPrism.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ protected Operand build(Variable result, Node node) {
209209
return buildConstantWritePath((ConstantPathWriteNode) node);
210210
// ConstantPathTargetNode processed in multiple assignment
211211
} else if (node instanceof ConstantReadNode) {
212-
return buildConstantRead((ConstantReadNode) node);
212+
return buildConstantRead(result, (ConstantReadNode) node);
213213
} else if (node instanceof ConstantWriteNode) {
214214
return buildConstantWrite((ConstantWriteNode) node);
215215
} else if (node instanceof DefNode) {
@@ -980,8 +980,8 @@ private Operand buildConstantPathOrWrite(ConstantPathOrWriteNode node) {
980980
return buildOpAsgnConstDeclOr(node.target, node.value, symbol(determineBaseName(node.target)));
981981
}
982982

983-
private Operand buildConstantRead(ConstantReadNode node) {
984-
return addResultInstr(new SearchConstInstr(temp(), CurrentScope.INSTANCE, node.name, false));
983+
private Operand buildConstantRead(Variable result, ConstantReadNode node) {
984+
return searchConst(result, node.name);
985985
}
986986

987987
private Operand buildConstantWrite(ConstantWriteNode node) {

0 commit comments

Comments
 (0)