Author: Armin Rigo <ar...@tunes.org>
Branch: cffi-1.0
Changeset: r1715:631dcc7cd174
Date: 2015-04-15 19:01 +0200
http://bitbucket.org/cffi/cffi/changeset/631dcc7cd174/

Log:    next test

diff --git a/new/recompiler.py b/new/recompiler.py
--- a/new/recompiler.py
+++ b/new/recompiler.py
@@ -106,6 +106,10 @@
     def _emit_bytecode_PointerType(self, tp, index):
         self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[tp.totype])
 
+    def _emit_bytecode_FunctionPtrType(self, tp, index):
+        raw = tp.as_raw_function()
+        self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[raw])
+
     # ----------
 
     def _prnt(self, what=''):
diff --git a/new/test_recompiler.py b/new/test_recompiler.py
--- a/new/test_recompiler.py
+++ b/new/test_recompiler.py
@@ -30,11 +30,20 @@
     check_type_table("double sin(double *, double *);",
                      "(FUNCTION 4)(POINTER 4)(NOOP 1)(FUNCTION_END 0)"
                      "(PRIMITIVE 14)")
+    check_type_table("double sin(double *, double *, double);",
+                     "(FUNCTION 3)(POINTER 3)(NOOP 1)(PRIMITIVE 14)"
+                     "(FUNCTION_END 0)")
 
 def test_dont_use_noop_for_primitives():
     check_type_table("double sin(double, double);",
                      "(FUNCTION 1)(PRIMITIVE 14)(PRIMITIVE 14)(FUNCTION_END 
0)")
 
+def test_funcptr_as_argument():
+    check_type_table("int sin(double(float));",
+                     "(FUNCTION 6)(PRIMITIVE 13)(FUNCTION_END 0)"
+                     "(FUNCTION 7)(POINTER 0)(FUNCTION_END 0)"
+                     "(PRIMITIVE 14)(PRIMITIVE 7)")
+
 
 def test_math_sin():
     ffi = FFI()
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to