[pypy-svn] r23131 - pypy/branch/genc-gc-refactoring

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Feb 8 00:49:57 CET 2006


Author: cfbolz
Date: Wed Feb  8 00:49:55 2006
New Revision: 23131

Modified:
   pypy/branch/genc-gc-refactoring/funcgen.py
Log:
move some repeated code into gen_op


Modified: pypy/branch/genc-gc-refactoring/funcgen.py
==============================================================================
--- pypy/branch/genc-gc-refactoring/funcgen.py	(original)
+++ pypy/branch/genc-gc-refactoring/funcgen.py	Wed Feb  8 00:49:55 2006
@@ -144,12 +144,13 @@
             vanishing_exc_value = self.expr(v)
             yield 'RPyConvertExceptionToCPython(%s);' % vanishing_exc_value
             for cleanupop in exc_cleanup_ops:
-                line = self.gen_op(cleanupop, 'should_never_be_jumped_to')
+                for line in self.gen_op(cleanupop, 'should_never_be_jumped_to'):
+                    yield line
                 if '\n' in line:
                     for l in line.splitlines():
                         yield l
                 else:
-                        yield line
+                    yield line
         yield 'return %s; ' % self.error_return_value()
 
     # ____________________________________________________________
@@ -185,11 +186,7 @@
             yield 'block%d:' % myblocknum
             for i, op in enumerate(block.operations):
                 err   = 'err%d_%d' % (myblocknum, i)
-                line = self.gen_op(op, err)
-                if '\n' in line:
-                    for subline in line.splitlines():
-                        yield subline
-                else:
+                for line in self.gen_op(op, err):
                     yield line
             fallthrough = False
             if len(block.exits) == 0:
@@ -313,12 +310,8 @@
                     else:
                         fallthrough = False    # this label was already generated
                     for cleanupop in op.cleanup:
-                        line = self.gen_op(cleanupop, 'should_never_be_jumped_to')
-                        if '\n' in line:
-                            for l in line.splitlines():
-                                yield l
-                        else:
-                            yield line
+                        for line in self.gen_op(cleanupop, 'should_never_be_jumped_to'):
+                           yield line
                     for line in self.return_with_error():
                         yield line
 
@@ -356,7 +349,11 @@
             lst.append(self.expr(op.result))
             lst.append(err)
             line = '%s(%s);' % (macro, ', '.join(lst))
-        return line
+        if "\n" not in line:
+            yield line
+        else:
+            for line in line.splitlines():
+                yield line
 
     # ____________________________________________________________
 



More information about the Pypy-commit mailing list