[pypy-svn] r65307 - in pypy/branch/io-lang/pypy/lang/io: . test
david at codespeak.net
david at codespeak.net
Tue May 19 12:40:02 CEST 2009
Author: david
Date: Tue May 19 12:40:01 2009
New Revision: 65307
Modified:
pypy/branch/io-lang/pypy/lang/io/object.py
pypy/branch/io-lang/pypy/lang/io/test/test_object.py
Log:
add anonymous slot to object, which evaluates and returns given argument
Modified: pypy/branch/io-lang/pypy/lang/io/object.py
==============================================================================
--- pypy/branch/io-lang/pypy/lang/io/object.py (original)
+++ pypy/branch/io-lang/pypy/lang/io/object.py Tue May 19 12:40:01 2009
@@ -39,4 +39,8 @@
@register_method('Object', 'do')
def w_object_do(space, w_target, w_message, w_context):
w_message.arguments[0].eval(space, w_target, w_context)
- return w_target
\ No newline at end of file
+ return w_target
+
+ at register_method('Object', '', unwrap_spec=[object, object])
+def w_object_(space, w_target, w_arg):
+ return w_arg
Modified: pypy/branch/io-lang/pypy/lang/io/test/test_object.py
==============================================================================
--- pypy/branch/io-lang/pypy/lang/io/test/test_object.py (original)
+++ pypy/branch/io-lang/pypy/lang/io/test/test_object.py Tue May 19 12:40:01 2009
@@ -13,4 +13,9 @@
inp = 'Object do(a := 23; b := method(a + 5); a := 1); Object b'
res, space = interpret(inp)
assert res.value == 6
- assert space.w_object.slots['a'].value == 1
\ No newline at end of file
+ assert space.w_object.slots['a'].value == 1
+
+def test_object_anon_slot():
+ inp = 'Object getSlot("+")("foo")'
+ res, space = interpret(inp)
+ assert res.value == 'foo'
\ No newline at end of file
More information about the Pypy-commit
mailing list