natural / java2python

Simple but effective library to translate Java source code to Python.
GNU Lesser General Public License v2.1
564 stars 243 forks source link

empty blocks with comments #47

Open yucer opened 8 years ago

yucer commented 8 years ago

Here is another case. Is there anyway we can help to fix them ?

if (a > 1)
{
  # comment from java code (maybe a todo)
}
else
{
   result = 4
}

becomes in Python:

if a > 1:
  # comment from java code (maybe a todo)
else
   result = 4

That construction is not valid in Python, it needs at less a pass sentence besides the comments. This way:

if a > 1:
  # comment from java code (maybe a todo)
  pass
else
  result = 4