[pypy-svn] r37972 - pypy/dist/pypy/lang/js
santagada at codespeak.net
santagada at codespeak.net
Mon Feb 5 16:40:33 CET 2007
Author: santagada
Date: Mon Feb 5 16:40:13 2007
New Revision: 37972
Modified:
pypy/dist/pypy/lang/js/interpreter.py
pypy/dist/pypy/lang/js/jsobj.py
Log:
some changes to make it rpython
Modified: pypy/dist/pypy/lang/js/interpreter.py
==============================================================================
--- pypy/dist/pypy/lang/js/interpreter.py (original)
+++ pypy/dist/pypy/lang/js/interpreter.py Mon Feb 5 16:40:13 2007
@@ -222,7 +222,7 @@
#d = dict(enumerate(self.items))
array = W_Array()
for i in range(len(self.list)):
- array.Put(str(i), self.list[i])
+ array.Put(str(i), self.list[i].eval(ctx).GetValue())
return array
Modified: pypy/dist/pypy/lang/js/jsobj.py
==============================================================================
--- pypy/dist/pypy/lang/js/jsobj.py (original)
+++ pypy/dist/pypy/lang/js/jsobj.py Mon Feb 5 16:40:13 2007
@@ -229,15 +229,15 @@
else:
return 'object'
- def str_builtin(self, ctx, args, this):
- return W_String(self.ToString())
+def str_builtin(ctx, args, this):
+ return W_String(this.ToString())
class W_Object(W_PrimitiveObject):
def __init__(self, ctx=None, Prototype=None, Class='Object',
Value=w_Undefined, callfunc=None):
W_PrimitiveObject.__init__(self, ctx, Prototype,
Class, Value, callfunc)
- self.propdict['toString'] = Property('toString', W_Builtin(self.str_builtin))
+ self.propdict['toString'] = Property('toString', W_Builtin(str_builtin))
class W_Builtin(W_PrimitiveObject):
@@ -280,8 +280,7 @@
def __init__(self, ctx=None, Prototype=None, Class='Array',
Value=w_Undefined, callfunc=None):
W_PrimitiveObject.__init__(self, ctx, Prototype, Class, Value, callfunc)
- toString = W_Builtin()
- toString.set_builtin_call(self.str_builtin)
+ toString = W_Builtin(array_str_builtin)
self.Put('toString', toString)
self.Put('length', W_Number(0))
self.array = []
@@ -317,12 +316,13 @@
except ValueError:
return W_PrimitiveObject.Get(self, P)
- def str_builtin(self, ctx, args, this):
- return W_String(self.ToString())
-
def ToString(self):
return ','.join(self.array)
+def array_str_builtin(ctx, args, this):
+ return W_String(this.ToString())
+
+
class W_Boolean(W_Primitive):
def __init__(self, boolval):
More information about the Pypy-commit
mailing list