[pypy-svn] r66535 - in pypy/branch/io-lang/pypy/lang/io: . test

david at codespeak.net david at codespeak.net
Thu Jul 23 12:37:07 CEST 2009


Author: david
Date: Thu Jul 23 12:37:07 2009
New Revision: 66535

Modified:
   pypy/branch/io-lang/pypy/lang/io/message.py
   pypy/branch/io-lang/pypy/lang/io/test/test_message.py
Log:
arguments on Message

Modified: pypy/branch/io-lang/pypy/lang/io/message.py
==============================================================================
--- pypy/branch/io-lang/pypy/lang/io/message.py	(original)
+++ pypy/branch/io-lang/pypy/lang/io/message.py	Thu Jul 23 12:37:07 2009
@@ -6,7 +6,12 @@
     if arg_num < len(w_message.arguments):
         return w_message.arguments[arg_num]
     return space.w_nil
-    
+
+ at register_method('Message', 'arguments')
+def message_arguments(space, w_receiver, w_message, w_context):
+  return space.w_list.clone_and_init(space, w_receiver.arguments)
+  
+
 # @register_method('Message', 'setIsActivatable', unwrap_spec=[object, bool])
 # def message_setIsActivatable(space, w_target, setting):
 #     w_target.activateable = setting

Modified: pypy/branch/io-lang/pypy/lang/io/test/test_message.py
==============================================================================
--- pypy/branch/io-lang/pypy/lang/io/test/test_message.py	(original)
+++ pypy/branch/io-lang/pypy/lang/io/test/test_message.py	Thu Jul 23 12:37:07 2009
@@ -1,5 +1,5 @@
 from pypy.lang.io.parserhack import interpret
-from pypy.lang.io.model import W_Message, W_Block
+from pypy.lang.io.model import W_Message, W_Block, W_List
 import py
 
 
@@ -14,7 +14,16 @@
     inp = 'a := message(foo(2,3,4)); a argAt(1)'
     res, space = interpret(inp)
     assert res.name == '3'
-    
+
+def test_message_arguments():
+  inp = """msg := message(B(C D, E));
+  msg arguments"""
+  res, space = interpret(inp)
+  assert isinstance(res, W_List)
+  assert res[0].name == 'C'
+  assert res[0].next.name == 'D' 
+  assert res[1].name == 'E'
+  
 # def test_setIsActivatable():
 #     inp = "a := block(1);a setIsActivateable(true); a"
 #     res,space = interpret(inp)



More information about the Pypy-commit mailing list