[pypy-svn] r47706 - in pypy/dist/pypy/lang/smalltalk: . test
arigo at codespeak.net
arigo at codespeak.net
Mon Oct 22 17:25:13 CEST 2007
Author: arigo
Date: Mon Oct 22 17:25:12 2007
New Revision: 47706
Added:
pypy/dist/pypy/lang/smalltalk/ (props changed)
pypy/dist/pypy/lang/smalltalk/__init__.py (contents, props changed)
pypy/dist/pypy/lang/smalltalk/model.py (contents, props changed)
pypy/dist/pypy/lang/smalltalk/test/ (props changed)
pypy/dist/pypy/lang/smalltalk/test/__init__.py (contents, props changed)
pypy/dist/pypy/lang/smalltalk/test/test_model.py (contents, props changed)
Log:
(all)
Started the basic object model of Smalltalk.
Added: pypy/dist/pypy/lang/smalltalk/__init__.py
==============================================================================
Added: pypy/dist/pypy/lang/smalltalk/model.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lang/smalltalk/model.py Mon Oct 22 17:25:12 2007
@@ -0,0 +1,13 @@
+
+class W_Object:
+ def __init__(self, w_class):
+ self.w_class = w_class
+
+class W_Class(W_Object):
+ def __init__(self, w_class, w_superclass):
+ W_Object.__init__(self, w_class)
+ self.w_superclass = w_superclass
+ self.methoddict = {}
+
+ def new(self):
+ return W_Object(self)
Added: pypy/dist/pypy/lang/smalltalk/test/__init__.py
==============================================================================
Added: pypy/dist/pypy/lang/smalltalk/test/test_model.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lang/smalltalk/test/test_model.py Mon Oct 22 17:25:12 2007
@@ -0,0 +1,7 @@
+from pypy.lang.smalltalk import model
+
+def test_new():
+ w_mycls = model.W_Class(None, None)
+ w_myinstance = w_mycls.new()
+ assert isinstance(w_myinstance, model.W_Object)
+ assert w_myinstance.w_class is w_mycls
More information about the Pypy-commit
mailing list