[pypy-svn] r45925 - in pypy/dist/pypy/translator/cli: . test

antocuni at codespeak.net antocuni at codespeak.net
Thu Aug 23 11:37:48 CEST 2007


Author: antocuni
Date: Thu Aug 23 11:37:46 2007
New Revision: 45925

Modified:
   pypy/dist/pypy/translator/cli/cts.py
   pypy/dist/pypy/translator/cli/test/test_snippet.py
Log:
mark "ole" as a keyword for ilasm



Modified: pypy/dist/pypy/translator/cli/cts.py
==============================================================================
--- pypy/dist/pypy/translator/cli/cts.py	(original)
+++ pypy/dist/pypy/translator/cli/cts.py	Thu Aug 23 11:37:46 2007
@@ -122,7 +122,8 @@
     "readonly", "refanytype", "refanyval", "rem", "ret", "rethrow",
     "shl", "shr", "sizeof", "starg", "stelem", "stfld", "stind",
     "stloc", "stobj", "stsfld", "sub", "switch", "tail", "throw",
-    "unaligned", "unbox", "volatile", "xor"])
+    "unaligned", "unbox", "volatile", "xor", "ole"])
+    # ole is not a keyword, but mono ilasm fails if you use it as a field/method name
 
     def __init__(self, db):
         self.db = db
@@ -235,7 +236,7 @@
                 METH = meth._TYPE
                 virtual = getattr(meth, '_virtual', True)
             class_name = self.db.class_name(TYPE)
-            full_name = 'class %s::%s' % (class_name, name)
+            full_name = 'class %s::%s' % (class_name, self.escape_name(name))
             returntype = self.lltype_to_cts(METH.RESULT)
             arg_types = [self.lltype_to_cts(ARG) for ARG in METH.ARGS if ARG is not ootype.Void]
             arg_list = ', '.join(arg_types)

Modified: pypy/dist/pypy/translator/cli/test/test_snippet.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_snippet.py	(original)
+++ pypy/dist/pypy/translator/cli/test/test_snippet.py	Thu Aug 23 11:37:46 2007
@@ -13,3 +13,13 @@
         res = self.ll_to_list(self.interpret(fn, []))
         assert res == [52, 53, 54]
 
+    def test_mangle(self):
+        class Foo:
+            def le(self):
+                return 42
+
+        def fn():
+            f = Foo()
+            return f.le()
+        res = self.interpret(fn, [], backendopt=False)
+        


More information about the pypy-svn mailing list