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

fijal at codespeak.net fijal at codespeak.net
Fri Apr 4 07:48:46 CEST 2008


Author: fijal
Date: Fri Apr  4 07:48:46 2008
New Revision: 53322

Modified:
   pypy/branch/js-refactoring/pypy/lang/js/baseop.py
   pypy/branch/js-refactoring/pypy/lang/js/interpreter.py
   pypy/branch/js-refactoring/pypy/lang/js/jscode.py
Log:
Some fixes in order to pass most of Number test suite. more follows...


Modified: pypy/branch/js-refactoring/pypy/lang/js/baseop.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/baseop.py	(original)
+++ pypy/branch/js-refactoring/pypy/lang/js/baseop.py	Fri Apr  4 07:48:46 2008
@@ -213,7 +213,7 @@
         raise ThrowException(W_String('it is not a constructor'))
     return res
 
-def uminus(obj):
+def uminus(obj, ctx):
     if isinstance(obj, W_IntNumber):
         return W_IntNumber(-obj.intval)
     return W_FloatNumber(-obj.ToNumber(ctx))

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 Apr  4 07:48:46 2008
@@ -474,10 +474,18 @@
         put_values(w_Number, {
             'constructor': w_FncPrototype,
             'prototype': w_NumPrototype,
-            'NaN': W_FloatNumber(NaN),
-            'POSITIVE_INFINITY': W_FloatNumber(Infinity),
-            'NEGATIVE_INFINITY': W_FloatNumber(-Infinity),
         })
+        w_Number.propdict['prototype'].ro = True
+        w_Number.Put('MAX_VALUE', W_FloatNumber(1.7976931348623157e308),
+                     ro=True, dd=True)
+        w_Number.Put('MIN_VALUE', W_FloatNumber(0), ro=True, dd=True)
+        w_Number.Put('NaN', W_FloatNumber(NaN), ro=True, dd=True)
+        # ^^^ this is exactly in test case suite
+        w_Number.Put('POSITIVE_INFINITY', W_FloatNumber(Infinity),
+                     ro=True, dd=True)
+        w_Number.Put('NEGATIVE_INFINITY', W_FloatNumber(-Infinity),
+                     ro=True, dd=True)
+        
 
         w_Global.Put('Number', w_Number)
         

Modified: pypy/branch/js-refactoring/pypy/lang/js/jscode.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/jscode.py	(original)
+++ pypy/branch/js-refactoring/pypy/lang/js/jscode.py	Fri Apr  4 07:48:46 2008
@@ -490,7 +490,7 @@
 
 class UMINUS(BaseUnaryOperation):
     def eval(self, ctx, stack):
-        stack.append(uminus(stack.pop()))
+        stack.append(uminus(stack.pop(), ctx))
 
 class NOT(BaseUnaryOperation):
     def eval(self, ctx, stack):
@@ -543,7 +543,7 @@
         name = elem.ToString()
         value = self.operation(ctx, left, name, value)
         left.Put(name, value)
-        stack.append(left)
+        stack.append(value)
 
 class STORE_MEMBER(BaseStoreMember):
     def operation(self, ctx, left, elem, value):



More information about the Pypy-commit mailing list