Fix bug in metaprogramming API

This commit is contained in:
Alexey Andreev 2019-10-07 18:45:43 +03:00
parent 378111d767
commit 92403f9ec0

View File

@ -681,6 +681,7 @@ public class CompositeMethodGenerator {
BasicBlock target = program.basicBlockAt(returnBlockIndex); BasicBlock target = program.basicBlockAt(returnBlockIndex);
if (valueToReturn != null) { if (valueToReturn != null) {
Variable valueToReturnResolved = var(valueToReturn);
if (resultVar == null) { if (resultVar == null) {
resultVar = program.createVariable(); resultVar = program.createVariable();
resultPhi = new Phi(); resultPhi = new Phi();
@ -689,7 +690,7 @@ public class CompositeMethodGenerator {
} }
Incoming incoming = new Incoming(); Incoming incoming = new Incoming();
incoming.setSource(program.basicBlockAt(blockIndex)); incoming.setSource(program.basicBlockAt(blockIndex));
incoming.setValue(var(valueToReturn)); incoming.setValue(valueToReturnResolved);
resultPhi.getIncomings().add(incoming); resultPhi.getIncomings().add(incoming);
} }