diff --git a/.gitignore b/.gitignore index 2130e0d..0bc28d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.class *.egg-info *.pyc +.idea/ +build/ diff --git a/java2python/compiler/visitor.py b/java2python/compiler/visitor.py index f62e53e..9984767 100644 --- a/java2python/compiler/visitor.py +++ b/java2python/compiler/visitor.py @@ -452,7 +452,8 @@ def acceptFor(self, node, memo): else: whileStat.expr.walk(cond, memo) whileBlock = self.factory.methodContent(parent=self) - if not node.firstChildOfType(tokens.BLOCK_SCOPE).children: + # issue 25 fix : https://github.com/natural/java2python/issues/25 + if node.firstChildOfType(tokens.BLOCK_SCOPE) and not node.firstChildOfType(tokens.BLOCK_SCOPE).children: self.factory.expr(left='pass', parent=whileBlock) else: whileBlock.walk(node.firstChildOfType(tokens.BLOCK_SCOPE), memo)