[pypy-svn] r36707 - pypy/dist/pypy/rpython

fijal at codespeak.net fijal at codespeak.net
Sun Jan 14 00:24:47 CET 2007


Author: fijal
Date: Sun Jan 14 00:24:46 2007
New Revision: 36707

Modified:
   pypy/dist/pypy/rpython/extfunc.py
Log:
Add a convinient annotation, which will later be annotated properly (when having bookkeeper)


Modified: pypy/dist/pypy/rpython/extfunc.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunc.py	(original)
+++ pypy/dist/pypy/rpython/extfunc.py	Sun Jan 14 00:24:46 2007
@@ -4,6 +4,24 @@
 from pypy.objspace.flow.model import Constant
 from pypy.annotation.model import unionof
 from pypy.annotation.signature import annotation
+from pypy.annotation import model as annmodel
+
+class _callable(object):
+    """ A way to specify the callable annotation, but deferred until
+    we have bookkeeper
+    """
+    def __init__(self, args, result=None):
+        self.args = args
+        self.result = result
+
+class _ext_callable(ExtRegistryEntry):
+    _type_ = _callable
+    # we defer a bit annotation here
+
+    def compute_result_annotation(self):
+        return annmodel.SomeGenericCallable([annotation(i, self.bookkeeper)
+                                             for i in self.instance.args],
+                           annotation(self.instance.result, self.bookkeeper))
 
 class ExtFuncEntry(ExtRegistryEntry):
     def compute_result_annotation(self, *args_s):



More information about the Pypy-commit mailing list