[pypy-commit] lang-smalltalk default: changed beCursorWithMask: to also accept forms as argument (BE_CURSOR primitive)

lwassermann noreply at buildbot.pypy.org
Mon Apr 22 14:07:27 CEST 2013


Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch: 
Changeset: r304:e1d89224e688
Date: 2013-04-21 13:32 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/e1d89224e688/

Log:	changed beCursorWithMask: to also accept forms as argument
	(BE_CURSOR primitive)

diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -587,9 +587,17 @@
     if argcount == 1:
         # TODO: use mask
         w_mask = s_frame.peek(0)
-        if not isinstance(w_mask, model.W_WordsObject):
+        if isinstance(w_mask, model.W_WordsObject):
+            mask_words = w_mask.words
+        elif isinstance(w_mask, model.W_PointersObject):
+            # mask is a form object
+            w_contents = w_mask.fetch(interp.space, 0)
+            if isinstance(w_contents, model.W_WordsObject):
+                w_mask = w_contents.words
+            else:
+                raise PrimitiveFailedError
+        else:
             raise PrimitiveFailedError()
-        mask_words = w_mask.words
     w_bitmap = w_rcvr.fetch(interp.space, 0)
     if not isinstance(w_bitmap, model.W_WordsObject):
         raise PrimitiveFailedError()


More information about the pypy-commit mailing list