usethesource / flybytes

Flybytes is an intermediate language between JVM bytecode and software languages (DSLs, PLs), for compilation and decompilation.
BSD 2-Clause "Simplified" License
16 stars 6 forks source link

increment operator in loop tests blocks decompilation of loops #9

Open jurgenvinju opened 4 years ago

jurgenvinju commented 4 years ago

For example, this loop is not recognized because the condition is not rewritten first to an expression, since it has side-effects with the x++. Special cases have to be detected for expressions with increment side-effects.

int whileWithContinue(int x) {
        while (x++ < 10) { 
            if (x % 2 == 0) {
                continue;
            }
            else {
                println(x);
            }
        }

        return x;
    }