Author: Stephan <[email protected]>
Branch:
Changeset: r75:5c14672790dc
Date: 2011-05-18 16:17 +0200
http://bitbucket.org/pypy/lang-js/changeset/5c14672790dc/
Log: implemented STORE_MEMBER_PREINCR
diff --git a/js/jscode.py b/js/jscode.py
--- a/js/jscode.py
+++ b/js/jscode.py
@@ -621,7 +621,7 @@
def operation(self, ctx, value):
return decrement(ctx, value)
-class STORE_MEMBER_PREINCR(Opcode):
+class BaseStoreMemberPre(Opcode):
def eval(self, ctx, stack):
left = stack.pop()
elem = stack.pop()
@@ -631,9 +631,14 @@
left.ToObject(ctx).Put(ctx, name, value)
stack.append(value)
+class STORE_MEMBER_PREINCR(BaseStoreMemberPre):
def operation(self, ctx, value):
return increment(ctx, value)
+class STORE_MEMBER_PREDECR(BaseStoreMemberPre):
+ def operation(self, ctx, value):
+ return decrement(ctx, value)
+
class STORE_MEMBER_SUB(BaseStoreMember):
def operation(self, *args):
raise NotImplementedError
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
@@ -668,6 +668,10 @@
yield assertv, "var x = {y:1}; ++x.y; x.y;", 2
yield assertv, "var x = {y:1}; ++x.y;", 2
+def test_member_predecrement():
+ yield assertv, "var x = {y:2}; --x.y; x.y;", 1
+ yield assertv, "var x = {y:2}; --x.y;", 1
+
def switch_test_code(x):
return """
function f(x) {
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit