Author: Stephan <[email protected]>
Branch:
Changeset: r54:5e289d7f90a8
Date: 2011-05-09 11:37 +0200
http://bitbucket.org/pypy/lang-js/changeset/5e289d7f90a8/
Log: implemented STORE_MEMBER_PREINCR
diff --git a/js/jscode.py b/js/jscode.py
--- a/js/jscode.py
+++ b/js/jscode.py
@@ -594,9 +594,18 @@
def operation(self, ctx, value):
return decrement(ctx, value)
-class STORE_MEMBER_PREINCR(BaseStoreMember):
- def operation(self, *args):
- raise NotImplementedError
+class STORE_MEMBER_PREINCR(Opcode):
+ def eval(self, ctx, stack):
+ left = stack.pop()
+ elem = stack.pop()
+ name = elem.ToString(ctx)
+ value = left.ToObject(ctx).Get(ctx, name)
+ value = self.operation(ctx, value)
+ left.ToObject(ctx).Put(ctx, name, value)
+ stack.append(value)
+
+ def operation(self, ctx, value):
+ return increment(ctx, value)
class STORE_MEMBER_SUB(BaseStoreMember):
def operation(self, *args):
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
@@ -659,7 +659,11 @@
def test_member_increment():
yield assertv, "var x = {y:1}; x.y++; x.y;", 2
- yield assertv, "var x = {y:1}; x.y++;""", 1
+ yield assertv, "var x = {y:1}; x.y++;", 1
+def test_member_preincrement():
+ yield assertv, "var x = {y:1}; ++x.y; x.y;", 2
+ yield assertv, "var x = {y:1}; ++x.y;", 2
+
def test_member_decrement():
yield assertv, " var x = {y:2}; x.y--; x.y;", 1
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit