java2python
java2python copied to clipboard
wrong translation of x++ operator
Here is another one. I don't know if this comes from ANTLR, or is something that could be solved here.
The Java code:
if (condition):
myArr[count++] = index;
# .. more code here
myArr[count++] = index;
is translated to:
__count_1 = count
count += 1
__count_2 = count
count += 1
if condition:
myArr[__count_1] = index;
# .. more code here
myArr[__count_2] = index;
It should be translated to:
if condition:
myArr[count] = index;
count += 1
# .. more code here
myArr[count] = index;
count += 1
Otherwise the result is not the same if the additional code between both assignments do change the count variable.