[pypy-svn] r64859 - pypy/branch/js-refactoring/pypy/lang/js
jandem at codespeak.net
jandem at codespeak.net
Thu Apr 30 15:38:55 CEST 2009
Author: jandem
Date: Thu Apr 30 15:38:55 2009
New Revision: 64859
Modified:
pypy/branch/js-refactoring/pypy/lang/js/interpreter.py
pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
Log:
Fix String.length on String objects, 40 more tests succeed now.
Modified: pypy/branch/js-refactoring/pypy/lang/js/interpreter.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/interpreter.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/interpreter.py Thu Apr 30 15:38:55 2009
@@ -91,8 +91,9 @@
def Construct(self, ctx, args=[]):
if len(args) >= 1:
Value = W_String(args[0].ToString(ctx))
- return create_object(ctx, 'String', Value = Value)
- return create_object(ctx, 'String', Value = W_String(''))
+ else:
+ Value = W_String('')
+ return Value.ToObject(ctx)
def create_array(ctx, elements=[]):
proto = ctx.get_global().Get(ctx, 'Array').Get(ctx, 'prototype')
Modified: pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/jsobj.py (original)
+++ pypy/branch/js-refactoring/pypy/lang/js/jsobj.py Thu Apr 30 15:38:55 2009
@@ -391,7 +391,7 @@
def ToObject(self, ctx):
o = create_object(ctx, 'String', Value=self)
- o.Put(ctx, 'length', W_IntNumber(len(self.strval)), flags = RO|DD)
+ o.Put(ctx, 'length', W_IntNumber(len(self.strval)), flags = RO|DD|DE)
return o
def ToString(self, ctx=None):
More information about the Pypy-commit
mailing list