[pypy-svn] r65187 - pypy/branch/js-refactoring/pypy/lang/js
jandem at codespeak.net
jandem at codespeak.net
Sat May 9 19:12:22 CEST 2009
Author: jandem
Date: Sat May 9 19:12:22 2009
New Revision: 65187
Modified:
pypy/branch/js-refactoring/pypy/lang/js/jscode.py
Log:
Implement prefix increment/decrement, and fix postfix ops (all related tests pass)
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 Sat May 9 19:12:22 2009
@@ -654,15 +654,37 @@
class STORE_POSTINCR(BaseStore):
def process(self, ctx, name, stack):
value = ctx.resolve_identifier(ctx, name)
- newval = increment(ctx, value)
- stack.append(value)
+ num = value.ToNumber(ctx)
+ newval = W_FloatNumber(num + 1)
+
+ stack.append(W_FloatNumber(num))
return newval
class STORE_POSTDECR(BaseStore):
def process(self, ctx, name, stack):
value = ctx.resolve_identifier(ctx, name)
- newval = increment(ctx, value, -1)
- stack.append(value)
+ num = value.ToNumber(ctx)
+ newval = W_FloatNumber(num - 1)
+
+ stack.append(W_FloatNumber(num))
+ return newval
+
+class STORE_PREINCR(BaseStore):
+ def process(self, ctx, name, stack):
+ value = ctx.resolve_identifier(ctx, name)
+ num = value.ToNumber(ctx)
+ newval = W_FloatNumber(num + 1)
+
+ stack.append(newval)
+ return newval
+
+class STORE_PREDECR(BaseStore):
+ def process(self, ctx, name, stack):
+ value = ctx.resolve_identifier(ctx, name)
+ num = value.ToNumber(ctx)
+ newval = W_FloatNumber(num - 1)
+
+ stack.append(newval)
return newval
class LABEL(Opcode):
More information about the Pypy-commit
mailing list