Author: Stephan <[email protected]>
Branch:
Changeset: r326:8a2574c80508
Date: 2012-12-25 12:21 +0100
http://bitbucket.org/pypy/lang-js/changeset/8a2574c80508/
Log: fixed cleanup of loop head
diff --git a/js/operations.py b/js/operations.py
--- a/js/operations.py
+++ b/js/operations.py
@@ -1031,7 +1031,7 @@
def emit(self, bytecode):
self.setup.emit(bytecode)
- if isinstance(self.setup, Expression):
+ if isinstance(self.setup, Expression) or isinstance(self.setup,
VariableDeclList):
bytecode.emit('POP')
bytecode.emit('LOAD_UNDEFINED')
precond = bytecode.emit_startloop_label()
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
@@ -1097,3 +1097,7 @@
def test_instanceof():
assertv("function f(){this.a = 1;}; x = new f(); x instanceof f;", True)
assertv("function f(){this.a = 1;}; function g(){this.a = b;}; x = new
f(); x instanceof g;", False)
+
+
+def test_repeated_for_loop():
+ assertv("var a = 0; for(var x = 0; x < 10; x++){for(var y = 0; y < 10;
y++) {a += y}}; a;", 450)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit