[pypy-svn] r55572 - in pypy/branch/js-refactoring/pypy/lang/js: . test

fijal at codespeak.net fijal at codespeak.net
Wed Jun 4 19:40:38 CEST 2008


Author: fijal
Date: Wed Jun  4 19:40:36 2008
New Revision: 55572

Modified:
   pypy/branch/js-refactoring/pypy/lang/js/jscode.py
   pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
   pypy/branch/js-refactoring/pypy/lang/js/test/test_interp.py
Log:
Some translation fixes, one additional test.


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	Wed Jun  4 19:40:36 2008
@@ -476,22 +476,19 @@
         return W_IntNumber(op1|op2)
 
 class URSH(BaseBinaryBitwiseOp):
-    @staticmethod
-    def eval(ctx, stack):
+    def eval(self, ctx, stack):
         op2 = stack.pop().ToUInt32(ctx)
         op1 = stack.pop().ToUInt32(ctx)
         stack.append(W_IntNumber(op1 >> (op2 & 0x1F)))
 
 class RSH(BaseBinaryBitwiseOp):
-    @staticmethod
-    def eval(ctx, stack):
+    def eval(self, ctx, stack):
         op2 = stack.pop().ToUInt32(ctx)
         op1 = stack.pop().ToInt32(ctx)
         stack.append(W_IntNumber(op1 >> intmask(op2 & 0x1F)))
 
 class LSH(BaseBinaryBitwiseOp):
-    @staticmethod
-    def eval(ctx, stack):
+    def eval(self, ctx, stack):
         op2 = stack.pop().ToUInt32(ctx)
         op1 = stack.pop().ToInt32(ctx)
         stack.append(W_IntNumber(op1 << intmask(op2 & 0x1F)))
@@ -589,15 +586,15 @@
     decision = staticmethod(ADD.operation)
 
 class STORE_MEMBER_POSTINCR(BaseStoreMember):
-    def operation(self):
+    def operation(self, *args):
         raise NotImplementedError
 
 class STORE_MEMBER_PREINCR(BaseStoreMember):
-    def operation(self):
+    def operation(self, *args):
         raise NotImplementedError    
 
 class STORE_MEMBER_SUB(BaseStoreMember):
-    def operation(self):
+    def operation(self, *args):
         raise NotImplementedError
 
 class BaseStore(Opcode):
@@ -906,7 +903,7 @@
 
 class DELETE_MEMBER(Opcode):
     def eval(self, ctx, stack):
-        what = stack.pop().ToString()
+        what = stack.pop().ToString(ctx)
         obj = stack.pop().ToObject(ctx)
         stack.append(newbool(obj.Delete(what)))
 

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	Wed Jun  4 19:40:36 2008
@@ -572,8 +572,7 @@
                 return
             except KeyError:
                 pass
-        # if not, we need to put this thing in current scope
-        self.variable.Put(self.get_global(), name, value)
+        self.variable.Put(self, name, value)
 
     def delete_identifier(self, name):
         for i in range(len(self.scope)-1, -1, -1):

Modified: pypy/branch/js-refactoring/pypy/lang/js/test/test_interp.py
==============================================================================
--- pypy/branch/js-refactoring/pypy/lang/js/test/test_interp.py	(original)
+++ pypy/branch/js-refactoring/pypy/lang/js/test/test_interp.py	Wed Jun  4 19:40:36 2008
@@ -566,6 +566,9 @@
     py.test.skip("not supported")
     assertv("~1", -2)
 
+def test_delete_member():
+    assertv("x = 3; delete this.x", "true")
+
 def test_twoarray():
     assertp("""
     a1 = new Array();



More information about the Pypy-commit mailing list