[pypy-svn] r12846 - pypy/dist/pypy/translator/c/test

arigo at codespeak.net arigo at codespeak.net
Fri May 27 17:02:43 CEST 2005


Author: arigo
Date: Fri May 27 17:02:42 2005
New Revision: 12846

Modified:
   pypy/dist/pypy/translator/c/test/test_database.py
Log:
Generating fully-typed function calls works "out of the box".


Modified: pypy/dist/pypy/translator/c/test/test_database.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_database.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_database.py	Fri May 27 17:02:42 2005
@@ -1,5 +1,6 @@
 import autopath, sys
 from pypy.rpython.lltype import *
+from pypy.rpython.rtyper import RPythonTyper
 from pypy.translator.translator import Translator
 from pypy.translator.c.database import LowLevelDatabase
 from pypy.objspace.flow.model import Constant, Variable, SpaceOperation
@@ -163,3 +164,27 @@
     db.get(s)
     db.complete()
     dump_on_stdout(db)
+
+def test_function_call():
+    def g(x, y):
+        return x-y
+    def f(x):
+        return g(1, x)
+    t = Translator(f)
+    a = t.annotate([int])
+    RPythonTyper(t.annotator).specialize()
+
+    F = FuncType([Signed], Signed)
+    f = functionptr(F, "f", graph=t.getflowgraph())
+    db = LowLevelDatabase()
+    db.get(f)
+    db.complete()
+    dump_on_stdout(db)
+
+def INPROGRESS_test_func_as_pyobject():
+    def f(x):
+        return x+1
+    db = LowLevelDatabase()
+    db.get(pyobjectptr(f))
+    db.complete()
+    dump_on_stdout(db)



More information about the Pypy-commit mailing list