[pypy-commit] lang-js default: fixed try/finally

stepahn noreply at buildbot.pypy.org
Fri Dec 28 11:34:40 CET 2012


Author: Stephan <stephan at stzal.com>
Branch: 
Changeset: r259:34f878ba8b43
Date: 2012-06-06 12:28 +0200
http://bitbucket.org/pypy/lang-js/changeset/34f878ba8b43/

Log:	fixed try/finally

diff --git a/js/operations.py b/js/operations.py
--- a/js/operations.py
+++ b/js/operations.py
@@ -746,7 +746,8 @@
             catchexec = JsExecutableCode(catchcode)
             catchparam = self.catchparam.get_literal()
         else:
-            catchfunc = None
+            catchexec = None
+            catchparam = None
 
         if self.finallyblock:
             finallycode = JsCode()
@@ -754,7 +755,6 @@
             finallyexec = JsExecutableCode(finallycode)
         else:
             finallyexec = None
-        catchparam = self.catchparam.get_literal()
         bytecode.emit('TRYCATCHBLOCK', tryexec, catchparam, catchexec, finallyexec)
 
 class VariableDeclaration(Expression):
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
@@ -973,6 +973,7 @@
     assertv("function f() { try { return 1; } catch(e) { return -1; } }; f()", 1)
     assertv("function f() { try { throw('foo'); return 1; } catch(e) { return -1; } }; f()", -1)
     assertv("function f() { try { throw('foo'); return 1; } catch(e) { return -1; } finally { return 0; } }; f()", 0)
+    assertv("function f() { try { throw('foo'); return 1; } finally { return 0; } }; f()", 0)
 
 def test_instanceof():
     assertv("function f(){this.a = 1;}; x = new f(); x instanceof f;", True);


More information about the pypy-commit mailing list