Post-translation step: lifting to loop tests.
The tail recursion elimination step produces method bodies of the form
More precisely, if the method body has the form
while (true) {
if (<test>) {
return <expr>;
} else {
...
}
}it can be turned into
while (!<test>) {
...
}
return <expr>;Simillarly, if the method body has the form
while (true) {
if (<test>) {
....
} else {
return <expr>;
}
}it can be turned into
while (<test>) {
...
}
return <expr>;This post-translation step performs these transformations,
which produce more idiomatic looping code.
It should be possible to extend the scope of this post-translation step,
e.g. to cases in which the