python2.7-compiler-package-micropython

Changeset

30:f72b2becdfde
2013-11-28 Paul Boddie raw files shortlog changelog graph Produce a "pass" statement where compound statements are empty.
compiler/ast.py (file)
     1.1 --- a/compiler/ast.py	Sun Nov 17 00:24:20 2013 +0100
     1.2 +++ b/compiler/ast.py	Thu Nov 28 22:27:16 2013 +0100
     1.3 @@ -1887,7 +1887,8 @@
     1.4          return "Stmt(%r)" % (self.nodes,)
     1.5  
     1.6      def __str__(self):
     1.7 -        return "\n".join(map(str, flatten_statement(self.nodes)))
     1.8 +        nodes = flatten_statement(self.nodes)
     1.9 +        return "\n".join(map(str, nodes or [Pass()]))
    1.10  
    1.11      def visit(self, visitor, *args):
    1.12          return visitor.visitStmt(self, *args)