[pypy-svn] r64942 - pypy/branch/js-refactoring/pypy/lang/js

jandem at codespeak.net jandem at codespeak.net
Fri May 1 14:39:55 CEST 2009


Author: jandem
Date: Fri May  1 14:39:53 2009
New Revision: 64942

Modified:
   pypy/branch/js-refactoring/pypy/lang/js/interpreter.py
   pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
Log:
Fix ToInteger for 'undefined', and use it for String.IndexOf. 230 new tests pass.


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	Fri May  1 14:39:53 2009
@@ -415,7 +415,7 @@
         if len(args) < 2:
             pos = 0
         else:
-            pos = args[1].ToInt32(ctx)
+            pos = args[1].ToInteger(ctx)
         pos = min(max(pos, 0), size)
         return W_IntNumber(string.find(substr, pos))
 

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	Fri May  1 14:39:53 2009
@@ -78,6 +78,9 @@
     def __str__(self):
         return "w_undefined"
     
+    def ToInteger(self, ctx):
+        return 0
+    
     def ToNumber(self, ctx):
         return NAN
 



More information about the Pypy-commit mailing list