[pypy-svn] r52675 - in pypy/dist/pypy: annotation rpython/ootypesystem translator/cli/test

antocuni at codespeak.net antocuni at codespeak.net
Tue Mar 18 10:08:23 CET 2008


Author: antocuni
Date: Tue Mar 18 10:08:22 2008
New Revision: 52675

Modified:
   pypy/dist/pypy/annotation/unaryop.py
   pypy/dist/pypy/rpython/ootypesystem/rootype.py
   pypy/dist/pypy/translator/cli/test/test_dotnet.py
Log:
add support to call_args on low level static methods



Modified: pypy/dist/pypy/annotation/unaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/unaryop.py	(original)
+++ pypy/dist/pypy/annotation/unaryop.py	Tue Mar 18 10:08:22 2008
@@ -731,12 +731,17 @@
             return lltype_to_annotation(METH.RESULT)
 
 class __extend__(SomeOOStaticMeth):
-    def simple_call(m, *args_s):
-        llargs = [annotation_to_lltype(arg_s)._example() for arg_s in args_s]
-        smeth = m.method._example()
-        v = smeth(*llargs)
+
+    def call(m, args):
+        args_s, kwds_s = args.unpack()
+        if kwds_s:
+            raise Exception("keyword arguments to call to a low-level static method")
+        info = 'argument to ll static method call'
+        llargs = [annotation_to_lltype(s_arg, info)._defl() for s_arg in args_s]
+        v = m.method._example()(*llargs)
         return ll_to_annotation(v)
 
+
 #_________________________________________
 # weakrefs
 

Modified: pypy/dist/pypy/rpython/ootypesystem/rootype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rootype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/rootype.py	Tue Mar 18 10:08:22 2008
@@ -111,6 +111,13 @@
         vlist.append(cgraphs)
         return hop.genop("indirect_call", vlist, resulttype = hop.r_result.lowleveltype)
 
+    def rtype_call_args(self, hop):
+        from pypy.rpython.rbuiltin import call_args_expand
+        hop, _ = call_args_expand(hop, takes_kwds=False)
+        hop.swap_fst_snd_args()
+        hop.r_s_popfirstarg()
+        return self.rtype_simple_call(hop)
+
 
 class __extend__(pairtype(OOInstanceRepr, OOBoundMethRepr)):
 

Modified: pypy/dist/pypy/translator/cli/test/test_dotnet.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_dotnet.py	(original)
+++ pypy/dist/pypy/translator/cli/test/test_dotnet.py	Tue Mar 18 10:08:22 2008
@@ -536,11 +536,14 @@
             il.Emit(OpCodes.Ret)
             myfunc = meth.CreateDelegate(typeof(FUNCTYPE))
             return myfunc
-        
-        def fn():
+
+        def fn(x, y):
             myfunc = unbox(build_fn(), FUNCTYPE)
-            return myfunc(30, 12)
-        res = self.interpret(fn, [])
+            a = myfunc(x, y)
+            mytuple = (x, y)
+            b = myfunc(*mytuple)
+            return a+b
+        res = self.interpret(fn, [10, 11])
         assert res == 42
 
     def test_bound_delegate(self):



More information about the Pypy-commit mailing list