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

fijal at codespeak.net fijal at codespeak.net
Fri Apr 4 05:43:39 CEST 2008


Author: fijal
Date: Fri Apr  4 05:43:38 2008
New Revision: 53313

Modified:
   pypy/branch/js-refactoring/pypy/lang/js/jscode.py
   pypy/branch/js-refactoring/pypy/lang/js/jsobj.py
Log:
fix delete


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 05:43:38 2008
@@ -675,7 +675,7 @@
         self.name = name
 
     def eval(self, ctx, stack):
-        ctx.put(self.name, w_Undefined)
+        ctx.put(self.name, w_Undefined, dd=True)
 
     def __repr__(self):
         return 'DECLARE_VAR "%s"' % (self.name,)
@@ -825,15 +825,7 @@
     def eval(self, ctx, stack):
         what = stack.pop().ToString()
         obj = stack.pop().ToObject(ctx)
-        try:
-            P = obj.propdict[what]
-            if P.ro:
-                stack.append(newbool(False))
-                return
-            del obj.propdict[what]
-            stack.append(newbool(True))
-        except KeyError:
-            stack.append(newbool(False))
+        stack.append(newbool(obj.Delete(what)))
 
 OpcodeMap = {}
 

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 Apr  4 05:43:38 2008
@@ -536,7 +536,7 @@
             assert isinstance(obj, W_PrimitiveObject)
             try:
                 P = obj.propdict[name]
-                if P.ro:
+                if P.dd:
                     return False
                 del obj.propdict[name]
                 return True
@@ -544,9 +544,9 @@
                 pass
         return False
 
-    def put(self, name, value):
+    def put(self, name, value, dd=False):
         assert name is not None
-        self.variable.Put(name, value)
+        self.variable.Put(name, value, dd=dd)
     
     def get_global(self):
         return self.scope[-1]



More information about the Pypy-commit mailing list