[pypy-commit] lang-js default: implemented STORE_MEMBER_BITAND

stepahn noreply at buildbot.pypy.org
Wed May 18 19:27:45 CEST 2011


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r70:e3a477e97e82
Date: 2011-05-18 12:06 +0200
http://bitbucket.org/pypy/lang-js/changeset/e3a477e97e82/

Log:	implemented STORE_MEMBER_BITAND

diff --git a/js/jscode.py b/js/jscode.py
--- a/js/jscode.py
+++ b/js/jscode.py
@@ -590,6 +590,12 @@
         op1 = prev.ToInt32(ctx)
         return W_IntNumber(op0 ^ op1)
 
+class STORE_MEMBER_BITAND(BaseStoreMemberAssign):
+    def decision(self, ctx, value, prev):
+        op0 = value.ToInt32(ctx)
+        op1 = prev.ToInt32(ctx)
+        return W_IntNumber(op0 & op1)
+
 class BaseStoreMemberPost(Opcode):
     def eval(self, ctx, stack):
         left = stack.pop()
diff --git a/js/test/test_interp.py b/js/test/test_interp.py
--- a/js/test/test_interp.py
+++ b/js/test/test_interp.py
@@ -719,3 +719,9 @@
     yield assertv, 'var i = {x:0}; i.x^=1;', 1
     yield assertv, 'var i = {x:1}; i.x^=0;', 1
     yield assertv, 'var i = {x:1}; i.x^=1;', 0
+
+def test_member_bitand():
+    yield assertv, 'var i = {x:0}; i.x&=0;', 0
+    yield assertv, 'var i = {x:0}; i.x&=1;', 0
+    yield assertv, 'var i = {x:1}; i.x&=0;', 0
+    yield assertv, 'var i = {x:1}; i.x&=1;', 1


More information about the pypy-commit mailing list