MCStWriter.st
changeset 197 833c1cc5eafd
parent 143 d7354b2599b6
child 284 1149d058c87d
--- a/MCStWriter.st	Sat Aug 20 13:41:58 2011 +0200
+++ b/MCStWriter.st	Sat Aug 20 13:42:04 2011 +0200
@@ -22,6 +22,20 @@
 	definition hasComment ifTrue: [self writeClassComment: definition].
 !
 
+visitClassTraitDefinition: definition
+	self chunkContents: [:s | s
+		nextPutAll: definition baseTrait;
+		nextPutAll: ' classTrait';
+		cr; tab;
+		nextPutAll: 'uses: ';
+		nextPutAll: (definition classTraitComposition ifNil: ['{}'])]
+
+!
+
+visitMetaclassDefinition: definition
+	self writeMetaclassDefinition: definition
+!
+
 visitMethodDefinition: definition
 	self writeMethodPreamble: definition.
 	self writeMethodSource: definition.
@@ -31,6 +45,12 @@
 
 visitOrganizationDefinition: defintion
 	defintion categories do: [:cat | self writeCategory: cat].
+
+!
+
+visitTraitDefinition: definition
+	self writeClassDefinition: definition.
+	definition hasComment ifTrue: [self writeClassComment: definition].
 ! !
 
 !MCStWriter methodsFor:'writing'!
@@ -40,22 +60,26 @@
 !
 
 writeCategory: categoryName
-	stream
-		nextChunkPut: 'SystemOrganization addCategory: ', categoryName printString;
-		cr
+        stream
+                nextChunkPut: 'SystemOrganization addCategory: ', categoryName storeString;
+                cr
+
+    "Modified: / 12-09-2010 / 15:36:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 writeClassComment: definition
-	stream
-		cr;
-		nextPut: $!!;
-		nextPutAll: definition className;
-		nextPutAll: ' commentStamp: ';
-		store: definition commentStamp;
-		nextPutAll: ' prior: 0!!';
-		cr;
-		nextChunkPut: definition comment;
-		cr.
+        stream
+                cr;
+                nextPut: $!!;
+                nextPutAll: definition className;
+                nextPutAll: ' commentStamp: ';
+                store: definition commentStamp;
+                nextPutAll: ' prior: 0!!';
+                cr;
+                nextChunkPut: definition comment ? '';
+                cr.
+
+    "Modified: / 12-09-2010 / 17:05:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 writeClassDefinition: definition
@@ -63,30 +87,28 @@
 !
 
 writeDefinitions: aCollection
-        "initStream is an ugly hack until we have proper init defs"
-
-        initStream := String new writeStream.
+	"initStream is an ugly hack until we have proper init defs"
+	initStream := String new writeStream.
 
-        Smalltalk isSmalltalkX ifTrue:[
-            (MCDependencySorter sortItems: aCollection)
-                do: [:ea | ea accept: self]
-        ] ifFalse:[
-            (MCDependencySorter sortItems: aCollection)
-                do: [:ea | ea accept: self]
-                displayingProgress: 'Writing definitions...'.
-        ].        
-        stream nextPutAll: initStream contents.
+	(MCDependencySorter sortItems: aCollection)
+		do: [:ea | ea accept: self]
+		displayingProgress: 'Writing definitions...'.
+	
+	stream nextPutAll: initStream contents.
 !
 
 writeMetaclassDefinition: definition
-	self chunkContents: [:s | s
-		nextPutAll: definition className;
-		nextPutAll: ' class';
-		cr; tab;
-		nextPutAll: 'instanceVariableNames: ''';
-		nextPutAll: definition classInstanceVariablesString;
-		nextPut: $'.
-	]
+	self chunkContents: [:str |
+		str	nextPutAll: definition className;
+			nextPutAll: ' class';
+			cr; tab.
+			definition hasClassTraitComposition ifTrue: [
+				str	nextPutAll: 'uses: ';
+					nextPutAll: definition classTraitCompositionString;
+					cr; tab].
+			str	nextPutAll: 'instanceVariableNames: ''';
+				nextPutAll: definition classInstanceVariablesString;
+				nextPut: $']
 !
 
 writeMethodInitializer: aMethodDefinition
@@ -102,16 +124,18 @@
 !
 
 writeMethodPreamble: definition
-	stream
-		cr;
-		nextPut: $!!;
-		nextPutAll: definition fullClassName;
-		nextPutAll: ' methodsFor: ';
-		nextPutAll: definition category asString printString;
-		nextPutAll: ' stamp: ';
-		nextPutAll: definition timeStamp asString printString;
-		nextPutAll: '!!';
-		cr
+        stream
+                cr;
+                nextPut: $!!;
+                nextPutAll: definition fullClassName;
+                nextPutAll: ' methodsFor: ';
+                nextPutAll: definition category asString storeString;
+                nextPutAll: ' stamp: ';
+                nextPutAll: definition timeStamp asString storeString;
+                nextPutAll: '!!';
+                cr
+
+    "Modified: / 12-09-2010 / 15:39:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 writeMethodSource: definition
@@ -124,10 +148,10 @@
 
 !MCStWriter class methodsFor:'documentation'!
 
-version
-    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCStWriter.st,v 1.2 2009-10-26 15:25:23 cg Exp $'
+version_CVS
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCStWriter.st,v 1.3 2011-08-20 11:42:04 cg Exp $'
 !
 
-version_CVS
-    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCStWriter.st,v 1.2 2009-10-26 15:25:23 cg Exp $'
+version_SVN
+    ^ '§Id: MCStWriter.st 8 2010-09-12 17:15:52Z vranyj1 §'
 ! !