[pypy-svn] r48042 - in pypy/dist/pypy/lang/smalltalk: . test

niko at codespeak.net niko at codespeak.net
Fri Oct 26 13:41:36 CEST 2007


Author: niko
Date: Fri Oct 26 13:41:36 2007
New Revision: 48042

Modified:
   pypy/dist/pypy/lang/smalltalk/interpreter.py
   pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py
Log:
(niko, lukas)
make returnTopFromMethod return to the caller of
the home current, not the caller of the CURRENT
context



Modified: pypy/dist/pypy/lang/smalltalk/interpreter.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/interpreter.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/interpreter.py	Fri Oct 26 13:41:36 2007
@@ -157,16 +157,16 @@
         interp.w_active_context = w_return_to
 
     def returnReceiver(self, interp):
-        self._return(self.receiver(), interp, self.w_sender)
+        self._return(self.receiver(), interp, self.w_home.w_sender)
 
     def returnTrue(self, interp):
-        self._return(interp.TRUE, interp, self.w_sender)
+        self._return(interp.TRUE, interp, self.w_home.w_sender)
 
     def returnFalse(self, interp):
-        self._return(interp.FALSE, interp, self.w_sender)
+        self._return(interp.FALSE, interp, self.w_home.w_sender)
 
     def returnNil(self, interp):
-        self._return(interp.NIL, interp, self.w_sender)
+        self._return(interp.NIL, interp, self.w_home.w_sender)
 
     def returnTopFromMethod(self, interp):
         self._return(self.top(), interp, self.w_home.w_sender)

Modified: pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py	Fri Oct 26 13:41:36 2007
@@ -522,3 +522,13 @@
         [ 137, 117, 200, 164, 2, 112, 125, 201, 124 ],
         fakeliterals(wrap_int(3))) is objtable.w_nil
 
+def test_bc_value_return():
+    # valueReturn
+    # 	" (self >> #value1) byteCode "
+    # 	" (self >> #value1) literals "
+    # 
+    # 	[ ^ 1 ] value. ^ 2
+    assert interpret_bc(
+        [ 137, 117, 200, 164, 2, 118, 124, 201, 135, 119, 124 ],
+        fakeliterals()).value == 1
+



More information about the Pypy-commit mailing list