[pypy-svn] r26544 - in pypy/dist/pypy/translator/squeak: . test

nik at codespeak.net nik at codespeak.net
Sat Apr 29 04:45:02 CEST 2006


Author: nik
Date: Sat Apr 29 04:44:56 2006
New Revision: 26544

Modified:
   pypy/dist/pypy/translator/squeak/gensqueak.py
   pypy/dist/pypy/translator/squeak/test/runtest.py
   pypy/dist/pypy/translator/squeak/test/test_oo.py
Log:
don't let the GenSqueak constructor have so many side-effects. have
a separate method "gen" to actually start source generation.


Modified: pypy/dist/pypy/translator/squeak/gensqueak.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/gensqueak.py	(original)
+++ pypy/dist/pypy/translator/squeak/gensqueak.py	Sat Apr 29 04:44:56 2006
@@ -22,6 +22,7 @@
         self.generated_nodes = set()
         self.constant_insts = {}
 
+    def gen(self):
         graph = self.translator.graphs[0]
         self.pending_nodes.append(FunctionNode(self, graph))
         self.filename = '%s.st' % graph.name
@@ -30,6 +31,7 @@
         self.pending_nodes.append(SetupNode(self, self.constant_insts)) 
         self.gen_source(file)
         file.close()
+        return self.filename
 
     def gen_source(self, file):
         while self.pending_nodes:

Modified: pypy/dist/pypy/translator/squeak/test/runtest.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/test/runtest.py	(original)
+++ pypy/dist/pypy/translator/squeak/test/runtest.py	Sat Apr 29 04:44:56 2006
@@ -67,7 +67,9 @@
         self.graph = t.graphs[0]
         if conftest.option.view:
            t.viewcg()
-        return GenSqueak(udir, t)
+        gen = GenSqueak(udir, t)
+        gen.gen()
+        return gen
 
     def _write_startup(self):
         startup_st = udir.join("startup.st")

Modified: pypy/dist/pypy/translator/squeak/test/test_oo.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/test/test_oo.py	(original)
+++ pypy/dist/pypy/translator/squeak/test/test_oo.py	Sat Apr 29 04:44:56 2006
@@ -13,7 +13,8 @@
    t.buildrtyper(type_system="ootype").specialize()
    if view or conftest.option.view:
       t.viewcg()
-   GenSqueak(udir, t)
+   gen = GenSqueak(udir, t)
+   gen.gen()
 
 
 C = Instance("test", ROOT, {'a': (Signed, 3)})



More information about the Pypy-commit mailing list