[pypy-svn] r56697 - in pypy/branch/oo-jit/pypy/translator/cli: . test

antocuni at codespeak.net antocuni at codespeak.net
Mon Jul 21 14:05:33 CEST 2008


Author: antocuni
Date: Mon Jul 21 14:05:31 2008
New Revision: 56697

Modified:
   pypy/branch/oo-jit/pypy/translator/cli/metavm.py
   pypy/branch/oo-jit/pypy/translator/cli/test/test_dotnet.py
Log:
really use the element type when storing an element of an array



Modified: pypy/branch/oo-jit/pypy/translator/cli/metavm.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/cli/metavm.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/cli/metavm.py	Mon Jul 21 14:05:31 2008
@@ -197,7 +197,7 @@
             generator.ilasm.opcode('ldnull')
         else:
             generator.load(v_elem)
-        elemtype = generator.cts.lltype_to_cts(v_array.concretetype)
+        elemtype = generator.cts.lltype_to_cts(v_array.concretetype._ELEMENT)
         generator.ilasm.opcode('stelem', elemtype)
 
 class _TypeOf(MicroInstruction):

Modified: pypy/branch/oo-jit/pypy/translator/cli/test/test_dotnet.py
==============================================================================
--- pypy/branch/oo-jit/pypy/translator/cli/test/test_dotnet.py	(original)
+++ pypy/branch/oo-jit/pypy/translator/cli/test/test_dotnet.py	Mon Jul 21 14:05:31 2008
@@ -282,6 +282,14 @@
             return x[0]
         assert self.interpret(fn, []) is None
 
+    def test_array_setitem(self):
+        def fn():
+            array = new_array(System.Object, 5)
+            array[0] = ArrayList()
+            return array[0].GetType().get_Name()
+        res = self.interpret(fn, [])
+        assert res == 'ArrayList'
+
     def test_array_length(self):
         def fn():
             x = init_array(System.Object, box(42), box(43))



More information about the Pypy-commit mailing list