[pypy-svn] r43754 - in pypy/dist/pypy/lang/js: . test
santagada at codespeak.net
santagada at codespeak.net
Sun May 27 23:17:55 CEST 2007
Author: santagada
Date: Sun May 27 23:17:53 2007
New Revision: 43754
Modified:
pypy/dist/pypy/lang/js/operations.py
pypy/dist/pypy/lang/js/test/test_interp.py
Log:
made return work properly and remove some code from call that was masking the problem in sourceelements and block that shoudl be the place to threat a return statement.
Modified: pypy/dist/pypy/lang/js/operations.py
==============================================================================
--- pypy/dist/pypy/lang/js/operations.py (original)
+++ pypy/dist/pypy/lang/js/operations.py Sun May 27 23:17:53 2007
@@ -219,11 +219,7 @@
else:
r7 = r6
- try:
- retval = r3.Call(ctx=ctx, args=r2.get_args(), this=r7)
- return retval
- except ExecutionReturned, e:
- return e.value
+ return r3.Call(ctx=ctx, args=r2.get_args(), this=r7)
class Comma(BinaryOp):
@@ -789,7 +785,7 @@
return last
except Exception, e:
if isinstance(e, ExecutionReturned) and e.type == 'return':
- raise
+ return e.value
else:
# TODO: proper exception handling
print "exception in line: %s, on: %s%s"%(node.pos.lineno, node, os.linesep)
Modified: pypy/dist/pypy/lang/js/test/test_interp.py
==============================================================================
--- pypy/dist/pypy/lang/js/test/test_interp.py (original)
+++ pypy/dist/pypy/lang/js/test/test_interp.py Sun May 27 23:17:53 2007
@@ -85,8 +85,9 @@
assertp('x=function(){print(3);}; x();', '3')
def test_function_returns():
- yield assertp, 'x=function(){return 1;}; print(x()+x());', '2'
+ yield assertv, 'x=function(){return 1;}; x()+x();', 2
yield assertp, 'function x() { return; };', []
+ yield assertv, 'function x() { d=2; return d;}; x()', 2
def test_var_declaration():
yield assertv, 'var x = 3; x;', 3
More information about the Pypy-commit
mailing list