[pypy-svn] r28217 - pypy/dist/pypy/translator/js2

fijal at codespeak.net fijal at codespeak.net
Sun Jun 4 11:13:52 CEST 2006


Author: fijal
Date: Sun Jun  4 11:13:51 2006
New Revision: 28217

Modified:
   pypy/dist/pypy/translator/js2/_class.py
   pypy/dist/pypy/translator/js2/database.py
   pypy/dist/pypy/translator/js2/function.py
   pypy/dist/pypy/translator/js2/jts.py
   pypy/dist/pypy/translator/js2/opcodes.py
Log:
Fixed class names to support module names as well.


Modified: pypy/dist/pypy/translator/js2/_class.py
==============================================================================
--- pypy/dist/pypy/translator/js2/_class.py	(original)
+++ pypy/dist/pypy/translator/js2/_class.py	Sun Jun  4 11:13:51 2006
@@ -10,7 +10,7 @@
         self.db = db
         self.cts = db.type_system_class(db)
         self.classdef = classdef
-        self.name = classdef._name.split('.')[-1]
+        self.name = classdef._name.replace('.', '_')#[-1]
 
         if not self.is_root(classdef):
             self.parent = self.db.pending_class(classdef._superclass)
@@ -64,7 +64,7 @@
         self.db.record_class(self.classdef, self.name)
     
     def basename(self, name):
-        return name.split('.')[-1]
+        return name.replace('.', '_')#[-1]
 
     #def _ctor(self):
     #    self.ilasm.begin_function('.ctor', [], 'void', False, 'specialname', 'rtspecialname', 'instance')

Modified: pypy/dist/pypy/translator/js2/database.py
==============================================================================
--- pypy/dist/pypy/translator/js2/database.py	(original)
+++ pypy/dist/pypy/translator/js2/database.py	Sun Jun  4 11:13:51 2006
@@ -226,7 +226,7 @@
 
     def init(self, ilasm):
         classdef = self.obj._TYPE
-        ilasm.new(classdef._name.split(".")[-1])
+        ilasm.new(classdef._name.replace(".", "_"))
     
     def record_fields(self):
         # we support only primitives, tuples, strings and lists

Modified: pypy/dist/pypy/translator/js2/function.py
==============================================================================
--- pypy/dist/pypy/translator/js2/function.py	(original)
+++ pypy/dist/pypy/translator/js2/function.py	Sun Jun  4 11:13:51 2006
@@ -166,7 +166,7 @@
         """ Block rendering routine using for variable trick
         """
         def basename(x):
-            return str(x).split('.')[-1]
+            return str(x).replace('.', '_')#[-1]
         
         self.ilasm.begin_for()
         

Modified: pypy/dist/pypy/translator/js2/jts.py
==============================================================================
--- pypy/dist/pypy/translator/js2/jts.py	(original)
+++ pypy/dist/pypy/translator/js2/jts.py	Sun Jun  4 11:13:51 2006
@@ -21,7 +21,7 @@
         self.db = db
     
     def __class(self, name):
-        return name.split(".")[-1]
+        return name.replace(".", "_")
     
     def llvar_to_cts(self, var):
         return 'var ', var.name

Modified: pypy/dist/pypy/translator/js2/opcodes.py
==============================================================================
--- pypy/dist/pypy/translator/js2/opcodes.py	(original)
+++ pypy/dist/pypy/translator/js2/opcodes.py	Sun Jun  4 11:13:51 2006
@@ -130,7 +130,7 @@
     def render(self, generator, op):
         # FIXME: just temporary hack
         generator.load(op.args[0])
-        generator.ilasm.load_const(op.args[1].value._name.split('.')[-1])
+        generator.ilasm.load_const(op.args[1].value._name.replace('.', '_'))#[-1])
         generator.cast_function("isinstanceof", 2)
 
 IsInstance = _IsInstance()



More information about the Pypy-commit mailing list