Author: Tim Felgentreff <[email protected]>
Branch: bitblt
Changeset: r202:a56c1ebcec7d
Date: 2013-03-18 13:01 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/a56c1ebcec7d/

Log:    expose Message class and doesNotUnderstand: symbol from special
        objects array

diff --git a/spyvm/constants.py b/spyvm/constants.py
--- a/spyvm/constants.py
+++ b/spyvm/constants.py
@@ -114,7 +114,7 @@
     "BlockClosure" : SO_BLOCKCLOSURE_CLASS,
     "Point" : SO_POINT_CLASS,
     "LargePositiveInteger" : SO_LARGEPOSITIVEINTEGER_CLASS,
-#    "Message" : SO_MESSAGE_CLASS,
+    "Message" : SO_MESSAGE_CLASS,
     "CompiledMethod" : SO_COMPILEDMETHOD_CLASS,
     "Semaphore" : SO_SEMAPHORE_CLASS,
     "Character" : SO_CHARACTER_CLASS,
@@ -134,6 +134,7 @@
     "special_selectors": SO_SPECIAL_SELECTORS_ARRAY,
     "smalltalkdict" : SO_SMALLTALK,
     "display" : SO_DISPLAY_OBJECT,
+    "doesNotUnderstand" : SO_DOES_NOT_UNDERSTAND,
     "interrupt_semaphore" : SO_USER_INTERRUPT_SEMAPHORE,
 }
 
diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -87,6 +87,7 @@
         define_cls("w_SmallInteger", "w_Integer")
         define_cls("w_LargePositiveInteger", "w_Integer", format=shadow.BYTES)
         define_cls("w_Float", "w_Number", format=shadow.BYTES)
+        define_cls("w_Message", "w_Object")
         define_cls("w_Collection", "w_Object")
         define_cls("w_SequenceableCollection", "w_Collection")
         define_cls("w_ArrayedCollection", "w_SequenceableCollection")
diff --git a/spyvm/test/test_miniimage.py b/spyvm/test/test_miniimage.py
--- a/spyvm/test/test_miniimage.py
+++ b/spyvm/test/test_miniimage.py
@@ -131,6 +131,8 @@
     assert str(w) == "Point class" 
     w = image.special(constants.SO_LARGEPOSITIVEINTEGER_CLASS)
     assert str(w) == "LargePositiveInteger class" 
+    w = image.special(constants.SO_MESSAGE_CLASS)
+    assert str(w) == "Message class" 
 
     # to be continued
 
@@ -348,3 +350,17 @@
     w_result = perform(interp.space.w_Float, "new")
     assert w_result is not None
     assert isinstance(w_result, model.W_Float)
+
+def test_doesNotUnderstand():
+    w_dnu = interp.space.objtable["w_doesNotUnderstand"]
+    assert isinstance(w_dnu, model.W_BytesObject)
+    assert w_dnu.as_string() == "doesNotUnderstand:"
+
+def test_Message():
+    w_message_cls = interp.space.w_Message
+    assert w_message_cls is interp.space.classtable["w_Message"]
+    assert isinstance(w_message_cls, model.W_PointersObject)
+    s_message_cls = w_message_cls.as_class_get_shadow(interp.space)
+    assert s_message_cls.getname() == "Message class"
+    w_message = s_message_cls.new()
+    assert isinstance(w_message, model.W_PointersObject)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to