ClassDefinitionChange.st
changeset 3203 2639572248b5
parent 3163 16fdcb5a998b
child 3205 5d3a00da5f5a
--- a/ClassDefinitionChange.st	Thu Apr 04 11:34:44 2013 +0200
+++ b/ClassDefinitionChange.st	Thu Apr 04 13:51:05 2013 +0200
@@ -50,7 +50,7 @@
 !ClassDefinitionChange class methodsFor:'others'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.76 2013-03-30 01:54:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.77 2013-04-04 11:51:05 cg Exp $'
 ! !
 
 !ClassDefinitionChange methodsFor:'accessing'!
@@ -377,14 +377,16 @@
 !ClassDefinitionChange methodsFor:'printing & storing'!
 
 definitionString
-    |ns classNameUsed superClassNameUsed selPart|
+    ^ self definitionStringInNamespace: (self nameSpaceOverride)
+!
 
-    ns := self nameSpaceOverride.
+definitionStringInNamespace: nsOrNil
+    |classNameUsed superClassNameUsed selPart|
 
     objectType == #variable ifTrue:[
         ^ String streamContents:[:stream |
-            ns notNil ifTrue:[
-                stream nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
+            nsOrNil notNil ifTrue:[
+                stream nextPutAll:((nsOrNil asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
             ] ifFalse:[
                 self halt:'can this happen ?'.
                 stream nextPutAll:'Smalltalk'
@@ -401,6 +403,7 @@
     "/ local name as argument, not the full name
     classNameUsed := self localClassName.
 
+    "/ selPart is the subclass:/variableSubclass/variableByteSubclass:/... - part
     selPart := (self definitionSelector ? #'subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:')
                     keywords first.         
 
@@ -408,117 +411,30 @@
         stream 
             nextPutAll:superClassNameUsed;
             nextPutAll:' ',selPart;
-            nextPutAll: classNameUsed asSymbol storeString;
-            cr;
-            spaces:4;
-            nextPutAll:'instanceVariableNames: ';
-            nextPutAll:(instanceVariableNames ? '') storeString;
-            cr;
-            spaces:4;
-            nextPutAll:'classVariableNames: ';
-            nextPutAll:(classVariableNames ? '') storeString;
-            cr;
-            spaces:4;
-            nextPutAll:'poolDictionaries: ';
-            nextPutAll:(poolDictionaries ? '') storeString;
-            cr.
+            nextPutLine: classNameUsed asSymbol storeString;
+            nextPutAll:'    instanceVariableNames: ';
+            nextPutLine:(instanceVariableNames ? '') storeString;
+            nextPutAll:'    classVariableNames: ';
+            nextPutLine:(classVariableNames ? '') storeString;
+            nextPutAll:'    poolDictionaries: ';
+            nextPutLine:(poolDictionaries ? '') storeString.
         private == true ifTrue:[
             stream 
-                spaces:4;
-                nextPutAll:'privateIn: ';
+                nextPutAll:'    privateIn: ';
                 nextPutAll:(self owningClassName)
         ] ifFalse:[
             stream 
-                spaces:4;
-                nextPutAll:'category: ';
-                nextPutAll:(category ? '') storeString
+                nextPutAll:'    category: ';
+                nextPutAll:(category ? '') asString storeString
         ].
       ]
 
     "Modified: / 13-06-2012 / 13:01:58 / cg"
 !
 
-definitionStringInNamespace: ns
-    | classNameUsed superClassNameUsed |
-
-    objectType == #variable ifTrue:[
-        ^ String streamContents:[:stream |
-            ns notNil ifTrue:[
-                stream 
-                    nextPutAll:((ns asCollectionOfSubstringsSeparatedBy:$.) asStringWith:'::')
-            ] ifFalse:[
-                self halt:'can this happen ?'.
-                stream 
-                    nextPutAll:'Smalltalk'
-            ].
-
-            stream 
-                nextPutAll:' addClassVarName:';
-                nextPutAll:className asString storeString
-          ].
-    ].
-
-    superClassNameUsed := self superClassName.
-    classNameUsed := self classNameWithoutNamespace.
+definitionStringWithoutNamespace
+    "cg - huh - who needs that? (the definitionString already does NOT include the classes namespace)"
 
-    ^ String streamContents:[:stream |
-        self isPrivateClassDefinitionChange ifFalse:[
-            stream 
-                nextPutAll:superClassNameUsed;
-                nextPutAll:' subclass:';
-                nextPutAll: classNameUsed asSymbol storeString
-                ;
-                cr;
-                tab;
-                nextPutAll:'instanceVariableNames:';
-                nextPutAll:(instanceVariableNames ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'classVariableNames:';
-                nextPutAll:(classVariableNames ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'poolDictionaries:';
-                nextPutAll:(poolDictionaries ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'category:';
-                nextPutAll:(category ? '') storeString;
-                cr
-        ] ifTrue:[
-            stream 
-                nextPutAll:superClassNameUsed;
-                nextPutAll:' subclass:';
-                nextPutAll: (self className copyFrom: owningClassName size + 3) asSymbol storeString
-                ;
-                cr;
-                tab;
-                nextPutAll:'instanceVariableNames:';
-                nextPutAll:(instanceVariableNames ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'classVariableNames:';
-                nextPutAll:(classVariableNames ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'poolDictionaries:';
-                nextPutAll:(poolDictionaries ? '') storeString;
-                cr;
-                tab;
-                nextPutAll:'privateIn:';
-                nextPutAll:
-                    (ns isNil
-                        ifTrue:[owningClassName]
-                        ifFalse:[owningClassName copyFrom: ns size + 3]);
-                cr
-        ]
-    ]
-
-    "Modified: / 06-10-2011 / 17:02:05 / cg"
-    "Created: / 20-03-2012 / 19:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-definitionStringWithoutNamespace
     |ns classNameUsed superClassNameUsed|
 
     ns := self nameSpaceOverride.
@@ -792,7 +708,7 @@
 !ClassDefinitionChange class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.76 2013-03-30 01:54:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.77 2013-04-04 11:51:05 cg Exp $'
 !
 
 version_SVN