When transforming final JS method to static methods, map phis and

try-catches as well
This commit is contained in:
konsoletyper 2015-02-15 19:22:37 +04:00
parent bc0fc8e406
commit e8803390d2

View File

@ -92,6 +92,18 @@ class JavascriptNativeProcessor {
for (Instruction insn : block.getInstructions()) { for (Instruction insn : block.getInstructions()) {
insn.acceptVisitor(variableMapper); insn.acceptVisitor(variableMapper);
} }
for (Phi phi : block.getPhis()) {
phi.setReceiver(program.variableAt(phi.getReceiver().getIndex() + 1));
for (Incoming incoming : phi.getIncomings()) {
incoming.setValue(program.variableAt(incoming.getValue().getIndex() + 1));
}
}
for (TryCatchBlock tryCatch : block.getTryCatchBlocks()) {
if (tryCatch.getExceptionVariable() != null) {
tryCatch.setExceptionVariable(program.variableAt(
tryCatch.getExceptionVariable().getIndex() + 1));
}
}
} }
callerMethod.setProgram(program); callerMethod.setProgram(program);
cls.addMethod(callerMethod); cls.addMethod(callerMethod);